/* === Redesign: Warm & Minimal palette === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Color+Emoji&display=swap');

:root {
  /* Фон — полупрозрачный, чтобы panorama просвечивала */
  --bg-main: rgba(245, 243, 239, 0.75);
  --bg-main-soft: rgba(235, 232, 226, 0.8);
  /* Сайдбар, навигация, карточки */
  --bg-sidebar: rgba(250, 249, 246, 0.88);
  --bg-sidebar-soft: rgba(242, 240, 235, 0.82);
  --bg-secondary: rgba(250, 249, 246, 0.88);
  /* Контент, формы, посты */
  --bg-content: rgba(255, 255, 255, 0.88);
  --bg-content-soft: rgba(250, 248, 245, 0.85);
  /* Полупрозрачные фоны поверх panorama */
  --blue: rgba(240, 236, 230, 1);
  --blue-soft: rgba(232, 227, 219, 0.92);
  --blue-lighter: rgba(247, 245, 241, 1);
  --white: rgba(250, 249, 246, 1);
  --white-soft: rgba(242, 240, 235, 0.95);
  --cyan: rgba(240, 236, 230, 1);
  --cyan-soft: rgba(232, 227, 219, 0.92);
  --brown: rgba(250, 248, 245, 1);
  --brown-soft: rgba(242, 239, 233, 0.95);
  /* Фон и блоки */
  --bg: transparent;
  --bg-card: rgba(245, 242, 237, 0.9);
  --bg-elevated: rgba(250, 249, 246, 0.93);
  /* Текст — глубокий темно-коричневый */
  --text: #2c2520;
  --text-muted: #6b6058;
  /* Акцент — изумрудный */
  --accent: #5a8fc7;
  --accent-hover: #4a7fb7;
  --accent-soft: rgba(90, 143, 199, 0.14);
  /* Границы — тонкие видимые */
  --border: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(90, 143, 199, 0.25);
  /* Тени — мягкие теплые */
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --radius: 16px;
  --radius-sm: 10px;
  --header-bg: rgba(250, 249, 246, 1);
  --header-text: #2c2520;
  /* Адаптивные ширины */
  --max-main: min(1200px, 98vw);
  --max-forum: min(1600px, 98vw);
  --max-full: min(800px, 98vw);
  --max-read: 75ch;
  --max-block: min(720px, 100%);
  --sidebar-w: min(280px, 100%);
  --forum-viewport-h: calc(100vh - 140px);
  --header-sidebar-w: 72px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: rgba(28, 26, 24, 0.825);
    --bg-main-soft: rgba(37, 34, 32, 0.875);
    --bg-sidebar: rgba(33, 31, 28, 0.955);
    --bg-sidebar-soft: rgba(42, 39, 37, 0.895);
    --bg-secondary: rgba(33, 31, 28, 0.955);
    --bg-content: rgba(40, 37, 35, 0.955);
    --bg-content-soft: rgba(46, 43, 40, 0.925);
    --blue: rgba(46, 42, 38, 1);
    --blue-soft: rgba(54, 50, 45, 1);
    --blue-lighter: rgba(42, 39, 36, 1);
    --white: rgba(46, 42, 38, 1);
    --white-soft: rgba(54, 50, 45, 1);
    --cyan: rgba(46, 42, 38, 1);
    --cyan-soft: rgba(54, 50, 45, 1);
    --brown: rgba(42, 39, 36, 1);
    --brown-soft: rgba(50, 48, 44, 1);
    --bg: transparent;
    --bg-card: rgba(50, 48, 44, 0.975);
    --bg-elevated: rgba(58, 55, 51, 1);
    --text: #e8e4df;
    --text-muted: #a09890;
    --accent: #6ea0d4;
    --accent-hover: #7cb0e0;
    --accent-soft: rgba(110, 160, 212, 0.18);
    --border: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(110, 160, 212, 0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.2);
    --header-bg: rgba(33, 31, 28, 1);
    --header-text: #e8e4df;
    color-scheme: dark;
  }
  #nature-bg {
    opacity: 0.12;
  }
  img {
    opacity: 0.92;
  }
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

/* ── Skip link (a11y) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.5rem 1rem;
  background: var(--accent, #5a8fc7);
  color: #fff;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
}

/* ── Lucide icon defaults ── */
.lucide {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  stroke-width: 1.8;
  flex-shrink: 0;
  display: inline-block;
}
.icon-sm { width: 0.9em; height: 0.9em; }
.icon-lg { width: 1.25em; height: 1.25em; }
.icon-pad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Button system ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.12s;
  line-height: 1.4;
  box-shadow: var(--shadow);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  border-color: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(90, 143, 199, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #3a6fa0 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(90, 143, 199, 0.3);
}
.btn-secondary {
  background: var(--bg-content);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--blue);
  color: var(--accent);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}
.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.15);
}
.btn-danger:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.btn-sm {
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 20px;
  box-shadow: none;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  min-height: 100%;
  background: transparent;
  font-size: 14px;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
}
::placeholder { color: var(--text-muted); opacity: 0.7; }

/* Header */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: clamp(0.75rem, 3vw, 1rem) clamp(1rem, 4vw, 1.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: none;
  width: 100%;
  max-width: 100%;
  border: none;
}
.site-header .logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}
.site-header .logo:hover { color: var(--accent); }

/* Десктоп: центрированные кнопки без полосы */
@media (min-width: 1025px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--header-h);
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    padding: 0 clamp(1rem, 3vw, 2rem);
    z-index: 200;
    transform: none;
    transition: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .site-header.is-open {
    transform: none;
  }
  .site-header .logo {
    display: none;
  }
  .header-menu-btn {
    display: none !important;
  }
  .site-header .header-nav {
    flex-direction: row;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .site-header .header-nav a {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    background: var(--bg-content);
    color: var(--text);
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }
  .site-header .header-nav a:hover {
    background: var(--blue);
    color: var(--accent);
    border-color: var(--border-accent);
  }
  .site-header .header-nav a.nav-cta {
    background: var(--accent);
    color: #fff;
  }
  .site-header .header-nav a.nav-cta:hover {
    background: var(--accent-hover);
  }
  .site-header .header-nav form {
    display: inline;
    margin-top: 0;
  }
  .site-header .header-nav form button {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    width: auto;
    text-align: center;
    background: var(--bg-content);
    color: var(--text);
    border-radius: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }
  .site-header .header-nav form button:hover {
    background: var(--blue);
    color: var(--accent);
    border-color: var(--border-accent);
  }
  body > main,
  body > footer {
    margin-left: 0;
  }
  body > main {
    padding-top: 4rem;
  }
  .header-overlay {
    display: none !important;
  }
}
/* Оверлей только на десктопе (скрытие на мобильных — в блоке ниже) */

/* Кнопка меню — только на планшетах и мобильных */
.header-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.header-menu-btn:hover {
  background: var(--white-soft);
}
.header-menu-icon {
  position: relative;
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
}
.header-menu-icon::before,
.header-menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s;
}
.header-menu-icon::before { top: -6px; }
.header-menu-icon::after { top: 6px; }
.header-menu-btn[aria-expanded="true"] .header-menu-icon {
  background: transparent;
}
.header-menu-btn[aria-expanded="true"] .header-menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.header-menu-btn[aria-expanded="true"] .header-menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Навигация — справа, верх чистый */
.site-header .header-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.site-header .header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.site-header .header-nav a:hover {
  color: var(--accent);
  background: var(--white);
}
.site-header .header-nav form { display: inline; }
.site-header .header-nav button {
  background: var(--white);
  color: var(--text-muted);
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.site-header .header-nav button:hover {
  background: var(--white-soft);
  color: var(--accent);
}
.site-header .header-nav a.nav-cta,
.mobile-menu-nav a.nav-cta {
  background: var(--accent);
  color: #fff;
}
.site-header .header-nav a.nav-cta:hover,
.mobile-menu-nav a.nav-cta:hover {
  background: var(--accent-hover);
  color: #fff;
}

/* Планшеты и мобильные: скрыть шапку, показать mobile-menu внутри контента */
@media (max-width: 1024px) {
  .site-header {
    display: none !important;
  }
  .header-overlay {
    display: none !important;
  }
}

/* Mobile menu (гамбургер внутри блока контента) */
.mobile-menu {
  display: none;
}
@media (max-width: 1024px) {
  .mobile-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: fixed;
    top: 0.5rem;
    right: 0.75rem;
    z-index: 1000;
  }
  .mobile-menu .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    color: var(--text);
  }
  .mobile-menu .mobile-menu-btn:hover {
    background: var(--accent-soft);
  }
  .mobile-menu-nav {
    display: none;
    position: absolute;
    top: 2.75rem;
    right: 0;
    min-width: 200px;
    max-width: min(280px, calc(100vw - 2rem));
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 200;
  }
  .mobile-menu-nav.is-open {
    display: flex;
  }
  .mobile-menu-nav a {
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
  }
  .mobile-menu-nav a:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .mobile-menu-nav form { margin: 0; }
  .mobile-menu-nav form button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
  }
  .mobile-menu-nav form button:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .mobile-menu-nav .header-notifications,
  .mobile-menu-nav .header-chat-link {
    position: relative;
  }
  .auth-page .mobile-menu {
    top: 0.5rem;
    right: 0.75rem;
  }
}

/* Main layout */
.site-main {
  display: flex;
  width: 100%;
  max-width: var(--max-main);
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 4vw, 1.5rem);
  gap: clamp(1rem, 3vw, 1.5rem);
  min-height: calc(100vh - var(--header-h));
}
.site-main.full-width { max-width: var(--max-full); }
.site-main.full-width.media-wide {
  max-width: var(--max-forum);
  padding-left: clamp(0.25rem, 1vw, 0.5rem);
  padding-right: clamp(0.25rem, 1vw, 0.5rem);
  height: calc(100vh - var(--header-h));
  min-height: 0;
}
.media-wide .content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.media-wide .media-grid {
  flex: 1;
  min-height: 0;
}
.site-main.full-width .content { flex: 1; }
.site-main.author-page { max-width: var(--max-main); }
.site-main.author-page .content { flex: 1; }
.site-main.full-width .content.chat-page { max-width: 100%; }
.site-main.full-width.has-chat-page { max-width: min(1400px, 98vw); }
@media (min-width: 1025px) {
  .site-main {
    padding-top: 4rem;
    padding-bottom: clamp(0.75rem, 2vw, 1rem);
    min-height: calc(100vh - 5.5rem);
  }
  .site-main.full-width.media-wide {
    height: calc(100vh - 5.5rem);
  }
}

/* Forum layout: left col (forum + bottom blocks) | right col (sticky chat) */
.forum-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start; /* обязательно для sticky */
  width: 100%;
  max-width: var(--max-forum);
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1rem);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  /* без height — страница скроллится свободно */
}

/* Three-column layout: 25% | 50% | 25%, full height */
.forum-layout-three-col {
  height: calc(100vh - var(--header-h));
  min-height: 0;
  max-width: 100%;
  align-items: stretch;
  padding: clamp(0.75rem, 2vw, 1rem);
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}
@media (min-width: 1025px) {
  .forum-layout-three-col {
    padding-top: 4rem;
    height: calc(100vh - 5.5rem);
  }
}
/* Общие стили для колонок */
.forum-layout-three-col .forum-center-col,
.forum-layout-three-col .forum-right-col.forum-chat-col {
  background: var(--bg-content);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.forum-layout-three-col .forum-left-col.forum-sidebar-col {
  flex: 1 1 25%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.forum-layout-three-col .forum-sidebar-col .forum-sidebar-top,
.forum-layout-three-col .forum-sidebar-col .forum-sidebar-bottom {
  flex: 1 1 50%;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-content);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: clamp(0.5rem, 1.5vw, 0.75rem);
}
.forum-layout-three-col .forum-sidebar-col .sidebar-block {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  padding: 0;
}
.forum-layout-three-col .forum-sidebar-col .sidebar-block.forum-stats {
  flex-shrink: 0;
}
.forum-layout-three-col .forum-center-col {
  flex: 2 2 50%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(0.5rem, 1.5vw, 0.75rem);
}
.forum-layout-three-col .forum-center-col > .forum-main.content {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}
.forum-layout-three-col .forum-center-col .forum-main.content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.forum-layout-three-col .forum-right-col.forum-chat-col {
  flex: 1 1 25%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(0.5rem, 1.5vw, 0.75rem);
}
.forum-layout-three-col .forum-chat-col .forum-col-chat {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  border-radius: 0;
  border: none;
  overflow: hidden;
}
.forum-layout-three-col .forum-chat-col .forum-col-chat .sidebar-block.chat-widget {
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

/* Убираем внутренние рамки: контент расширяется до границ колонок */
.forum-layout-three-col .forum-center-col .forum-main.content .edit-topic-form input,
.forum-layout-three-col .forum-center-col .forum-main.content .edit-topic-form textarea,
.forum-layout-three-col .forum-center-col .forum-main.content .edit-post-form textarea {
  background: transparent;
  border: none;
  box-shadow: none;
}
.forum-layout-three-col .forum-center-col .forum-main.content .edit-topic-form input:focus,
.forum-layout-three-col .forum-center-col .forum-main.content .edit-topic-form textarea:focus,
.forum-layout-three-col .forum-center-col .forum-main.content .edit-post-form textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.forum-layout-three-col .forum-center-col .forum-main.content .post {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.forum-layout-three-col .forum-center-col .forum-main.content .topic-description {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.forum-layout-three-col .forum-center-col .forum-main.content .new-topic-form {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.forum-layout-three-col .forum-center-col .forum-main.content .topic-item {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  transition: background 0.2s;
}
.forum-layout-three-col .forum-center-col .forum-main.content .topic-item a {
  transition: background 0.2s, color 0.2s;
}
.forum-layout-three-col .forum-center-col .forum-main.content .topic-item a:hover {
  background: var(--blue-soft);
  color: var(--accent-hover);
}
.forum-layout-three-col .forum-sidebar-col .sidebar-topic-item,
.forum-layout-three-col .forum-sidebar-col .sidebar-post-item {
  background: transparent;
  border: none;
  box-shadow: none;
  transition: background 0.2s;
}
.forum-layout-three-col .forum-sidebar-col .sidebar-topic-item:hover,
.forum-layout-three-col .forum-sidebar-col .sidebar-post-item:hover {
  background: var(--blue-soft);
}
.forum-layout-three-col .forum-sidebar-col .sidebar-topic-item a:hover,
.forum-layout-three-col .forum-sidebar-col .sidebar-post-item a:hover {
  color: var(--accent-hover);
}
.forum-layout-three-col .forum-chat-col .chat-messages,
.forum-layout-three-col .forum-chat-col .chat-input-row textarea {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.forum-layout-three-col .forum-chat-col .chat-input-row textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.forum-left-col {
  flex: 3 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}
.forum-left-col .forum-main {
  min-width: 0;
  max-width: 100%;
}
.forum-bottom-row {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}
.forum-bottom-row .forum-author-topics,
.forum-bottom-row .forum-user-replies {
  flex: 1 1 0;
  min-width: 0;
}
.forum-right-col {
  flex: 1 1 0;
  min-width: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
}
.forum-right-col .forum-col-chat {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}
.forum-right-col .forum-col-chat .sidebar-block.chat-widget {
  height: 100%;
}

/* Рамка форума */
.forum-layout .forum-main.content {
  background: var(--white);
}

/* Sidebar blocks (used in forum columns and other pages) */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
}
.sidebar-block {
  background: var(--bg-content);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.25rem);
  margin-bottom: 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-width: 0;
}
.sidebar-block h3 {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sidebar-block ul { margin: 0; padding: 0; list-style: none; }
.sidebar-block li { margin-bottom: 0.75rem; }
.sidebar-block li:last-child { margin-bottom: 0; }
.sidebar-block a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.sidebar-block a:hover { color: var(--accent-hover); }

.sidebar-topics .sidebar-topic-item {
  padding: 0.5rem;
  margin-bottom: 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
}
.sidebar-topics .sidebar-topic-item:last-child { margin-bottom: 0; }
.sidebar-topic-item a {
  display: block;
  padding: 0;
  border-bottom: none;
  color: inherit;
  text-decoration: none;
}
.sidebar-topic-title { display: block; margin-bottom: 0.25rem; color: var(--accent); font-weight: 500; }
.sidebar-topic-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.sidebar-topic-author { font-weight: 500; color: var(--text-muted); }
.sidebar-topic-replies { color: var(--accent); font-weight: 500; }
.sidebar-topic-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sidebar-post-item {
  margin-bottom: 0.35rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
}
.sidebar-post-item:last-child { margin-bottom: 0; }
.sidebar-post-item a {
  display: block;
  padding: 0;
  border-bottom: none;
}
.sidebar-post-author {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.sidebar-post-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.latest-posts li a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.25rem 0;
}
.latest-posts .sidebar-post-item a { white-space: normal; }
.muted { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

/* Content */
.content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  background: var(--bg-content);
  border-radius: var(--radius);
  padding: clamp(0.75rem, 2vw, 1rem);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.content h1 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.3;
}

/* Chat widget */
.chat-widget .chat-container { max-height: 280px; }
.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.chat-widget-header h3 { margin: 0; font-size: 1rem; }
.chat-widget-count {
  font-size: 0.65rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
}
.chat-widget-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-widget-btn {
  bottom: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}
.forum-col-chat .chat-typing-indicator {
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
}
.forum-col-chat {
  display: flex;
  flex-direction: column;
}
.forum-col-chat .sidebar-block.chat-widget {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.forum-col-chat .chat-widget .chat-container {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}
/* Когда не залогинен — блок входа вверху, не внизу */
.forum-col-chat .sidebar-block.chat-widget.chat-widget-guest {
  justify-content: flex-start;
}
.forum-col-chat .sidebar-block.chat-widget.chat-widget-guest .chat-container {
  flex: 0 0 auto;
}
.forum-col-chat .chat-container[data-user-id=""] .chat-area {
  flex: 0;
  min-height: 0;
}
.forum-col-chat .chat-widget .chat-messages {
  flex: 1 1 0;
  min-height: 180px;
  overflow-y: auto;
  display: block;
}
.forum-col-chat .chat-msg {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 85%;
  margin-bottom: 0.5rem;
}
.forum-col-chat .chat-msg.chat-msg-mine {
  margin-left: auto !important;
  margin-right: 0;
}
.forum-col-chat .chat-msg.chat-msg-other {
  margin-left: 0;
  margin-right: auto;
}
.chat-widget .chat-messages {
  overflow-y: auto;
}
.chat-widget .chat-scroll-down-btn {
  width: auto;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  font-size: 1rem;
  bottom: 0.5rem;
  right: 0.5rem;
}
.chat-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.chat-link:hover { color: var(--accent-hover); }

.chat-container { display: flex; flex-direction: column; max-width: 100%; min-width: 0; }
.chat-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.chat-page-header h1 { margin: 0; }
.chat-new-count {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chat-new-count:hover { background: var(--accent-hover); color: white; }
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.chat-new-msg-btn {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: none;
  transition: background 0.2s, transform 0.2s;
}
.chat-new-msg-btn:hover { background: var(--accent-hover); color: white; transform: translateX(-50%) scale(1.02); }
.chat-scroll-down-btn {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 10;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.2s;
}
.chat-scroll-down-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.chat-scroll-down-count {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.25rem;
  display: none;
  align-items: center;
  justify-content: center;
}
.chat-unread-separator {
  width: 100%;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-height: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
  scroll-margin: 2rem 0;
  box-sizing: border-box;
}
.chat-unread-separator::before,
.chat-unread-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(90, 143, 122, 0.3);
}
.chat-unread-separator-highlight {
  animation: unread-separator-highlight 1.2s ease-out;
}
@keyframes unread-separator-highlight {
  0% { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
  100% { color: var(--text-muted); font-weight: 400; background: transparent; }
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  max-width: 100%;
  min-width: 0;
  position: relative;
  background: var(--brown);
  /* backdrop-filter removed for performance */
  border-radius: var(--radius-sm);
  min-height: 100px;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.chat-date-separator {
  width: 100%;
  flex: 0 0 auto;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  font-weight: 500;
}
.chat-msg {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: max-content;
  max-width: 85%;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 12px;
  border: none;
  box-shadow: none;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.chat-msg.chat-msg-mine {
  align-self: flex-end;
  margin-left: auto;
  background: var(--blue);
}
.chat-msg.chat-msg-other {
  align-self: flex-start;
  background: var(--blue-lighter);
}
.chat-msg .msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.chat-msg .msg-author {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
}
.chat-msg.chat-msg-mine .msg-author { color: var(--accent-hover); }
.chat-msg .msg-header .msg-actions {
  margin-left: auto;
}
.chat-msg .msg-body { word-break: break-word; overflow-wrap: break-word; max-width: 100%; white-space: pre-wrap; }
.chat-msg .msg-reply-to {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-left: none;
  background: var(--brown-soft);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.chat-msg .msg-reply-to:hover { background: var(--brown); color: var(--text); }
.chat-msg.chat-msg-highlight {
  animation: chat-highlight 3s ease-out;
}
@keyframes chat-highlight {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}
.chat-msg .msg-edited { font-size: 0.7rem; color: var(--text-muted); }
.chat-msg .msg-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}
.chat-msg .msg-time {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
}
.msg-status {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: -1px;
}
.msg-status-delivered {
  color: var(--text-muted);
}
.msg-status-read {
  color: var(--accent);
}
.chat-msg .msg-actions { display: flex; gap: 0.25rem; }
.chat-add-reaction {
  margin-left: 0.25rem;
  font-size: 0.75rem;
  padding: 0.1rem 0.3rem;
  opacity: 0.5;
}
.chat-msg:hover .chat-add-reaction { opacity: 1; }
.chat-msg-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  font-size: 0.8rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}
.chat-msg-btn:hover { color: var(--accent); background: var(--accent-soft); }
.chat-msg .msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}
.chat-reaction {
  font-size: 0.85rem;
  padding: 0.15rem 0.4rem;
  border-radius: 12px;
  background: var(--brown-soft);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}
.chat-reaction:hover, .chat-reaction.active { background: var(--brown); }
/* Фон реакций в тон с пузырём сообщения */
.chat-msg.chat-msg-mine .msg-reactions .chat-reaction {
  background: var(--blue-soft) !important;
}
.chat-msg.chat-msg-mine .msg-reactions .chat-reaction:hover,
.chat-msg.chat-msg-mine .msg-reactions .chat-reaction.active {
  background: var(--blue) !important;
}
.chat-msg.chat-msg-other .msg-reactions .chat-reaction {
  background: var(--blue-lighter) !important;
}
.chat-msg.chat-msg-other .msg-reactions .chat-reaction:hover,
.chat-msg.chat-msg-other .msg-reactions .chat-reaction.active {
  background: var(--white-soft) !important;
}
.msg-reactions-picker {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
  max-height: 140px;
  overflow-y: auto;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  background: transparent;
  border: none;
}
.reaction-btn {
  background: var(--brown-soft);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
  border-radius: 6px;
  transition: background 0.2s;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}
.reaction-btn:hover { background: var(--brown); }
/* Пикер эмодзи: изначально в тон, при наведении — смена цвета */
.chat-msg.chat-msg-mine .msg-reactions-picker {
  background: var(--blue);
  padding: 0.35rem;
  border-radius: 8px;
}
.chat-msg.chat-msg-mine .msg-reactions-picker .reaction-btn {
  background: var(--blue);
}
.chat-msg.chat-msg-mine .msg-reactions-picker .reaction-btn:hover {
  background: var(--blue-soft);
}
.chat-msg.chat-msg-other .msg-reactions-picker {
  background: var(--blue-lighter);
  padding: 0.35rem;
  border-radius: 8px;
}
.chat-msg.chat-msg-other .msg-reactions-picker .reaction-btn {
  background: var(--blue-lighter);
}
.chat-msg.chat-msg-other .msg-reactions-picker .reaction-btn:hover {
  background: var(--white-soft);
}
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 1.5rem;
}
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: flex-end;
  position: relative;
}
.chat-input-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.chat-input-btn-label { display: none; }
.chat-input-btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brown-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-input-btn:hover { color: var(--accent); background: var(--brown-soft); }
.chat-input-row input[type="text"],
.chat-input-row textarea {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: "Inter", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", -apple-system, sans-serif;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
  min-height: 2.5rem;
  max-height: 120px;
  line-height: 1.4;
}
.chat-input-row textarea {
  overflow-y: auto;
}
.chat-input-row input[type="text"]:focus,
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.chat-input-wrap { position: relative; max-width: 100%; min-width: 0; }
.chat-emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.5rem;
  background: var(--brown);
  /* backdrop-filter removed for performance */
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(8, 1.75rem);
  gap: 0.25rem;
  max-height: 180px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}
.chat-emoji-picker button {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: 4px;
  transition: background 0.15s;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}
.chat-emoji-picker button:hover { background: var(--accent-soft); }
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  background: var(--brown-soft, #f5f0eb);
  border-left: 3px solid var(--accent);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  line-height: 1.3;
  min-height: 0;
}
.chat-reply-bar-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chat-reply-bar-author {
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.35rem;
}
.chat-reply-bar-text {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline;
}
.chat-reply-bar-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  transition: color 0.15s, background 0.15s;
}
.chat-reply-bar-close:hover {
  color: var(--text);
  background: var(--border);
}
.chat-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--brown);
  /* backdrop-filter removed for performance */
  border-radius: var(--radius-sm);
  border: none;
  max-width: 100%;
}
.chat-attach-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-attach-preview-item img, .chat-attach-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-attach-preview-item .chat-attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-attach-preview-item .chat-attach-remove:hover { background: #dc2626; }
.msg-attachments { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 100%; }
.msg-attachment-img, .msg-attachment-video {
  max-width: 280px;
  max-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
}
.msg-attachment-img img { width: 100%; height: auto; display: block; }
.msg-attachment-video video { width: 100%; max-height: 200px; }
.msg-link-preview {
  display: block;
  max-width: 320px;
  margin-top: 0.5rem;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--accent);
  background: var(--brown-soft);
  transition: background 0.2s;
  cursor: pointer;
}
.msg-link-preview:hover { background: var(--brown); text-decoration: underline; }
.msg-link-preview img { width: 100%; height: 140px; object-fit: cover; display: block; }
.msg-link-preview-content { padding: 0.5rem 0.75rem; }
.msg-link-preview-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.msg-link-preview-desc { font-size: 0.8rem; color: var(--text-muted); }
.link-preview-wrap { position: relative; display: inline-block; max-width: 320px; }
.post-link-previews .link-preview-star {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  background: rgba(0,0,0,0.55);
  color: #ffd700;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
  padding: 0;
}
.link-preview-wrap:hover .link-preview-star { opacity: 1; }
.post-link-previews .link-preview-star:hover { background: rgba(0,0,0,0.8); }
.chat-msg > .link-preview-star {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  background: none;
  border: none;
  color: #333;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  z-index: 2;
  transition: color 0.2s;
}
.chat-msg > .link-preview-star:hover { color: #555; }
.chat-msg > .link-preview-star svg { width: 15px; height: 15px; }
.chat-msg > .link-preview-star-added { color: #ffd700; }
.chat-msg > .link-preview-star-added svg { fill: #ffd700; }
.post-link-previews .link-preview-star-added { color: #ffd700; }
.post-link-previews .link-preview-star-added svg { fill: #ffd700; }
.post-link-previews { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }
.post-link-previews .msg-link-preview { margin-top: 0; }
.chat-input-row button {
  padding: 0.625rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.chat-input-row button:hover { background: var(--accent-hover); color: white; }
.chat-input-row button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Страница чата — шире, по центру, онлайн справа, на всю высоту */
.content.chat-page {
  padding: clamp(0.5rem, 2vw, 1rem);
  background: transparent;
  box-shadow: none;
  border: none;
  max-width: min(1100px, 100%);
  margin: 0 auto;
}
.chat-page .full-chat {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-page .chat-messages {
  flex: 1;
  min-height: 150px;
  padding: 1rem;
  overflow-y: auto;
  background: transparent;
  border: none;
  box-shadow: none;
}
.chat-page .chat-input-row textarea {
  background: transparent;
  border: none;
  box-shadow: none;
}
.chat-page .chat-input-row textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.chat-page .chat-msg { max-width: 80%; }

.chat-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 280px);
  grid-template-rows: auto 1fr;
  gap: 0 clamp(0.5rem, 1.5vw, 0.75rem);
  align-items: stretch;
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 450px;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 2vw, 1rem);
}
.chat-page-layout .chat-container {
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: clamp(1rem, 3vw, 1.25rem);
}
.chat-page-layout .chat-container .chat-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-page-layout .chat-container .chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
@media (min-width: 1025px) {
  .site-main.has-chat-page {
    height: calc(100vh - 5.5rem);
  }
  .content.chat-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .content.chat-page .chat-page-layout {
    flex: 1;
    height: auto;
    min-height: 0;
  }
}
.chat-online-panel {
  grid-column: 2;
  grid-row: 1 / -1;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.25rem);
  box-shadow: var(--shadow);
}
.chat-online-toggle { display: none !important; }
.chat-online-drawer { display: none; }
.chat-online-title {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.chat-online-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.chat-online-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chat-online-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  color: var(--text);
}
.chat-online-list li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.chat-online-list li a {
  color: inherit;
  text-decoration: none;
}
.chat-online-list li a:hover { color: var(--accent); }
.chat-online-list li .chat-msg-dm {
  margin-left: auto;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.chat-online-list li .chat-msg-dm:hover { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 900px) {
  #chat-emoji-btn, #sidebar-chat-emoji-btn,
  #chat-emoji-picker, #sidebar-chat-emoji-picker { display: none !important; }
  .chat-page-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 180px);
    min-height: 400px;
  }
  .chat-page-layout .chat-container { grid-column: 1; }
  .chat-tab-content { grid-column: 1; }
  .chat-tabs { grid-column: 1; }
  .chat-online-panel-desktop { display: none !important; }
  .chat-online-toggle { display: flex !important; align-items: center; gap: 0.25rem; }
  body.chat-drawer-open { overflow: hidden; }
  .chat-online-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 100;
    overflow-y: auto;
    transform-origin: bottom;
    animation: chat-drawer-up 0.25s ease-out;
  }
  .chat-online-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
  }
  .chat-online-drawer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
  }
  .chat-online-drawer-close:hover { color: var(--text); }
  .chat-online-drawer-list { list-style: none; margin: 0; padding: 0; }
  .chat-online-drawer-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.9rem;
  }
  .chat-online-drawer-list li::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
  }
  .chat-online-drawer-list li a {
    color: inherit;
    text-decoration: none;
  }
  .chat-online-drawer-list li a:hover { color: var(--accent); }
  .chat-online-drawer-list li .chat-msg-dm {
    flex-shrink: 0;
    margin-left: 1.5rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--text-muted);
    padding: 0.35rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
  }
  .chat-online-drawer-list li .chat-msg-dm:hover {
    color: var(--accent);
    background: var(--accent-soft);
  }
}
@keyframes chat-drawer-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Мобильный чат: без прокрутки страницы */
@media (max-width: 900px) {
  html.chat-page {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }
  body.chat-page-body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .header-overlay {
    display: none !important;
  }
  body.chat-page-body .chat-area {
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .site-main,
  body.chat-page-body main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    flex: 1;
    min-height: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .content.chat-page {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }
  body.chat-page-body .chat-page-layout {
    flex: 1;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    padding-top: 0.75rem;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    padding-bottom: 0.5rem;
  }
  body.chat-page-body .chat-page-layout .chat-tabs {
    margin-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
    padding: 0.75rem 3.5rem 0.5rem 0.75rem;
  }
  body.chat-page-body .chat-page-layout .chat-tab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .chat-page-layout .chat-tab-content .chat-container {
    border-radius: 0 0 var(--radius) var(--radius);
    margin-top: 0;
    padding: 0.5rem 0.75rem;
  }
  body.chat-page-body .chat-page-layout .chat-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .chat-page-layout .chat-container .chat-area {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.chat-page-body .chat-page-layout .chat-container .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0.75rem 1rem;

  }
  body.chat-page-body .chat-typing-indicator,
  body.chat-page-body .chat-input-wrap {
    flex-shrink: 0;
  }
  body.chat-page-body .chat-input-wrap {
    padding: 0.5rem 0.75rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    background: transparent;
    border-top: none;
  }
  body.chat-page-body .chat-input-wrap .chat-input-actions {
    align-items: center;
    align-self: flex-end;
  }
  body.chat-page-body .chat-input-wrap .chat-input-btn,
  body.chat-page-body .chat-input-wrap .chat-online-toggle,
  #chat-attach-btn,
  #chat-online-toggle,
  #dm-attach-btn {
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    height: 2.5rem !important;
    padding: 0 !important;
    border-radius: 50% !important;
    gap: 0 !important;
    flex: 0 0 2.5rem !important;
    align-self: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: var(--accent) !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
  }
  body.chat-page-body .chat-input-wrap #chat-attach-btn .chat-input-btn-label,
  body.chat-page-body .chat-input-wrap .chat-online-toggle .chat-input-btn-label,
  body.chat-page-body .chat-input-wrap #chat-online-toggle-count {
    display: none !important;
  }
  body.chat-page-body .chat-input-wrap #chat-attach-btn svg,
  body.chat-page-body .chat-input-wrap #chat-online-toggle svg,
  body.chat-page-body .chat-input-wrap #dm-attach-btn svg,
  #chat-attach-btn svg,
  #chat-online-toggle svg,
  #dm-attach-btn svg {
    stroke: white !important;
    color: white !important;
  }
  .forum-col-chat .chat-input-wrap .chat-input-btn .chat-input-btn-label {
    display: inline;
  }
  .forum-col-chat .chat-input-wrap .chat-input-btn {
    width: auto;
    min-width: 2.5rem;
    padding: 0 0.6rem;
    gap: 0.35rem;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: none;
    font-size: 0.85rem;
    font-weight: 500;
  }
  body.chat-page-body .chat-input-wrap .chat-input-btn:hover,
  body.chat-page-body .chat-input-wrap .chat-online-toggle:hover,
  #chat-attach-btn:hover,
  #chat-online-toggle:hover,
  #dm-attach-btn:hover {
    background: var(--accent-hover) !important;
    color: white !important;
  }
  body.chat-page-body .site-footer {
    display: none;
  }
}

@media (max-width: 600px) {
  body.chat-page-body .chat-page-layout {
    height: 100% !important;
    min-height: 0 !important;
  }
  .chat-page-layout {
    max-width: 100%;
    overflow-x: hidden;
    gap: 0;
    height: calc(100vh - 160px);
    min-height: 350px;
  }
  .chat-page .full-chat {
    max-width: 100%;
    min-width: 0;
  }
  body.chat-page-body .chat-page-layout .chat-container .chat-messages {
    min-height: 0;
    max-width: 100%;
  }
  .chat-page .chat-msg {
    max-width: 95%;
  }
  .chat-input-row {
    flex-wrap: nowrap;
    min-width: 0;
  }
  .chat-input-row input[type="text"],
  .chat-input-row textarea {
    min-width: 0;
  }
  .chat-emoji-picker {
    grid-template-columns: repeat(6, 1.5rem);
    max-width: calc(100vw - 2rem);
    left: 0;
    right: auto;
  }
  .chat-emoji-picker button {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1.1rem;
  }
  .msg-attachment-img,
  .msg-attachment-video {
    max-width: min(280px, 100%);
  }
  .msg-link-preview {
    max-width: min(320px, 100%);
  }
  .link-preview-wrap {
    max-width: min(320px, 100%);
  }
  .link-preview-star { opacity: 1; }
  .msg-reactions-picker {
    max-width: 100%;
  }
  .chat-page-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 400px) {
  .chat-input-actions { gap: 0.15rem; }
}

@media (min-width: 901px) and (max-width: 1024px) {
  .chat-tabs {
    padding-right: 3.5rem;
  }
}

/* Auth */
.auth-page {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  position: relative;
}
.auth-form {
  background: var(--bg-content);
  padding: clamp(1rem, 4vw, 2rem);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: 100%;
  max-width: min(400px, 96vw);
}
.auth-form h1 {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.auth-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.auth-form input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-top: 0.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.auth-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  border: 1px solid var(--accent-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(90, 143, 199, 0.25);
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.auth-form button:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #3a6fa0 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(90, 143, 199, 0.35);
}
.auth-form button:active {
  transform: translateY(1px);
}
.auth-form button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 8px rgba(90, 143, 199, 0.25);
}
.auth-form .error {
  color: #dc2626;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.auth-form p { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.auth-form p a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-form p a:hover { text-decoration: underline; }
.auth-agree {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}
.auth-agree input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.auth-agree .rules-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.auth-agree .rules-link:hover { color: var(--accent-hover); }
.rules-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.rules-modal {
  background: var(--brown, #fff);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.rules-modal h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  color: var(--text);
}
.rules-modal ol {
  padding-left: 1.25rem;
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.rules-modal ol li { margin-bottom: 0.5rem; }
.rules-close-btn { width: 100%; }

/* Forum */
.forum-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.forum-search {
  flex-wrap: wrap;
}
.forum-search input {
  flex: 1;
  min-width: 0;
  max-width: min(320px, 100%);
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.forum-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: none;
}
.pagination a { color: var(--accent); text-decoration: none; font-weight: 500; border-radius: 20px; padding: 0.25rem 0.625rem; transition: background 0.2s, color 0.2s; }
.pagination a:hover { background: var(--accent-soft); }
.pagination-info { color: var(--text-muted); font-size: 0.9rem; }
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-item {
  border-bottom: none;
  transition: background 0.15s, box-shadow 0.15s;
  margin-bottom: 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  overflow: hidden;
}
.topic-item:last-child { margin-bottom: 0; }
.topic-item a {
  display: block;
  padding: 1rem 1rem;
  text-decoration: none;
  color: inherit;
  border-radius: inherit;
  transition: background 0.15s;
}
.topic-item a:hover { background: var(--blue); }
.topic-item:hover { box-shadow: var(--shadow-md); }
.topic-item strong { font-weight: 600; font-size: 1rem; }
.topic-item .meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.topic-item .meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.topic-item .meta .lucide {
  opacity: 0.6;
  vertical-align: middle;
}
.new-topic-form {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.new-topic-form input,
.new-topic-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.new-topic-form input:focus,
.new-topic-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.new-topic-form textarea { resize: vertical; min-height: 60px; }

.topic-description-preview {
  margin: 0.25rem 0 0 0;
  padding: 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.topic-description {
  background: var(--bg-sidebar);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  white-space: pre-wrap;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  max-width: var(--max-read);
}
.topic-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.topic-meta a:not([href*="/edit"]) { color: var(--accent); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.topic-meta a:not([href*="/edit"]):hover { color: var(--accent-hover); }
.badge { font-size: 0.8rem; margin-right: 0.25rem; display: inline-flex; align-items: center; gap: 0.2rem; color: var(--text-muted); vertical-align: middle; }
.inline-form { display: inline; margin: 0 0.2rem; }
.inline-form button {
  border: none;
  font: inherit;
  cursor: pointer;
}
.post-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.post-header strong { font-weight: 600; }
.post-actions { margin-left: auto; font-size: 0.8rem; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; opacity: 0.4; transition: opacity 0.2s; }
.post:hover .post-actions { opacity: 1; }
.post-actions a, .post-actions .inline-form { margin-left: 0; }

/* ── Topic actions bar ── */
.topic-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
}
.topic-actions-bar .topic-actions-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.topic-actions-bar .topic-actions-spacer {
  flex: 1;
}
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.edit-topic-form input, .edit-post-form textarea,
.edit-topic-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.edit-topic-form input:focus, .edit-post-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.topic-context { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.topic-context a { color: var(--accent); }
.posts { margin: 1.5rem 0; }
.post {
  padding: 0.75rem 0.75rem;
  border-bottom: none;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
}
.post:last-of-type { margin-bottom: 0; }
.post-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
  font-weight: 500;
}
.post-content {
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: var(--max-read);
}
.reply-form {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
}
.reply-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.reply-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}

/* Author page */
.author-topics h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
}
.author-topic-card {
  background: var(--bg-content);
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 100%;
  transition: box-shadow 0.2s;
}
.author-topic-card:hover {
  box-shadow: var(--shadow-md);
}
.author-topic-card:last-child {
  margin-bottom: 0;
}
.author-topic-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.author-topic-card .topic-description {
  margin: 0.5rem 0 1rem;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  border-radius: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  max-width: 100%;
}
.author-topic-card .topic-meta {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.author-topic-card .topic-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}
.author-topic-card .topic-link:hover { color: var(--accent-hover); }
.author-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.25rem; }
.author-online-status { font-size: 0.85rem; margin-bottom: 1.5rem; }
.hint { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* Media */
.media-nav {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.media-nav a {
  padding: 0.35rem 0.75rem;
  background: var(--bg-content);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.media-nav a:hover {
  background: var(--blue);
  color: var(--accent);
  border-color: var(--border-accent);
}
.media-nav a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  max-width: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-content: start;
}
.media-grid::-webkit-scrollbar {
  display: none;
}
.media-card {
  background: var(--bg-content);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.media-card:hover { background: var(--bg-sidebar); box-shadow: var(--shadow-md); }
.media-card h3 { margin-top: 0; font-size: 1rem; font-weight: 600; }
.media-card p { font-size: 0.9rem; color: var(--text-muted); margin: 0.5rem 0; }
.media-card a { color: var(--accent); text-decoration: none; font-weight: 500; font-size: 0.9rem; }
.media-card a:hover { text-decoration: underline; }
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.media-card video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .media-grid { grid-template-columns: 1fr; }
}
.add-media-form {
  background: var(--bg-sidebar);
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.add-media-form h3 { margin-top: 0; font-size: 1rem; }
.add-media-form input,
.add-media-form select,
.add-media-form textarea {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  color: var(--text);
  padding: 0.625rem 0.875rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.add-media-form input[type="file"]::file-selector-button {
  background: var(--blue-soft);
  color: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: background 0.2s;
}
.add-media-form input[type="file"]::file-selector-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.articles-list .article-card {
  background: var(--bg-content);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: var(--max-block);
}
.articles-list .article-card h3 { margin-top: 0; }
.media-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  background: var(--blue);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  transition: background 0.2s, color 0.2s;
}
.media-back-link:hover {
  background: var(--blue-soft);
  color: var(--accent);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: none;
  margin-top: 0;
  background: transparent;
  /* backdrop-filter removed for performance */
  width: 100%;
  max-width: 100%;
}

/* Responsive — от мобильных до 4K (3840px) */
/* Большие экраны: 2K, 4K — расширяем контент */
@media (min-width: 1920px) {
  :root {
    --max-main: min(1400px, 98vw);
    --max-forum: min(1800px, 98vw);
    --max-full: min(900px, 98vw);
  }
}
@media (min-width: 2560px) {
  :root {
    --max-main: min(1600px, 98vw);
    --max-forum: min(2000px, 98vw);
    --max-full: min(1000px, 98vw);
    --max-block: min(800px, 100%);
  }
}
@media (min-width: 3840px) {
  :root {
    --max-main: min(1800px, 98vw);
    --max-forum: min(2400px, 98vw);
    --max-full: min(1100px, 98vw);
    --max-block: min(900px, 100%);
  }
}
/* Планшеты: чат перестаёт быть sticky, уходит под контент */
@media (max-width: 1100px) {
  .forum-layout:not(.forum-layout-three-col) {
    flex-direction: column;
  }
  .forum-left-col:not(.forum-sidebar-col) {
    flex: 1 1 100%;
  }
  .forum-right-col:not(.forum-chat-col) {
    flex: 1 1 100%;
    position: static;
    height: auto;
  }
  .forum-right-col:not(.forum-chat-col) .forum-col-chat {
    height: auto;
    min-height: 300px;
  }
  .forum-right-col:not(.forum-chat-col) .forum-col-chat .sidebar-block.chat-widget {
    height: auto;
  }
  .forum-col-chat .chat-widget .chat-container {
    min-height: 300px;
  }
}
@media (max-width: 1024px) {
  .forum-stats .stats-list {
    justify-content: center;
  }
  .forum-center-col > .forum-stats {
    margin-top: 0.5rem;
  }
}
/* Три колонки: на мобильных (< 900px) — только центральная колонка (форум) */
@media (max-width: 900px) {
  .forum-layout-three-col {
    flex-direction: column !important;
    min-height: calc(100vh - var(--header-h)) !important;
    height: auto !important;
    max-width: 100%;
    padding: 0.75rem 0.25rem 0.5rem;
  }
  .forum-layout-three-col .forum-left-col.forum-sidebar-col {
    display: none !important;
  }
  .forum-layout-three-col .forum-right-col.forum-chat-col {
    display: none !important;
  }
  .forum-layout-three-col .forum-center-col {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    order: 1;
    padding: 0 !important;
    border-radius: var(--radius);
  }
  .forum-layout-three-col .forum-center-col > .forum-main.content {
    flex: 1 1 auto !important;
    overflow: visible !important;
    min-height: 0;
  }
  .forum-mobile-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .forum-mobile-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: var(--accent-soft, rgba(59,130,246,0.1));
    color: var(--accent, #3b82f6);
    border-radius: var(--radius, 0.5rem);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
  }
  .forum-mobile-nav a:hover {
    background: var(--accent, #3b82f6);
    color: #fff;
  }
}
@media (min-width: 901px) {
  .forum-mobile-nav {
    display: none;
  }
}
/* Мобильные: нижние блоки в столбик */
@media (max-width: 768px) {
  .forum-bottom-row {
    flex-wrap: wrap;
  }
  .forum-bottom-row .forum-author-topics,
  .forum-bottom-row .forum-user-replies {
    flex: 1 1 100%;
  }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .site-main, .site-main.full-width, .site-main.author-page, .forum-layout, .forum-layout-three-col { max-width: 100%; }
  .site-main { padding: 0.75rem 0.25rem 0.5rem; gap: 0.5rem; }
  .site-main.full-width, .site-main.author-page { padding: 0.75rem 0.25rem 0.5rem; }
  .content { padding: 1rem 0.25rem; border-radius: var(--radius); }
  .auth-page { padding: 0.75rem 0.25rem 0.5rem; }
  .site-footer { padding: 0.5rem 0.25rem; }
}
@media (max-width: 900px) {
  .site-main, .site-main.full-width, .site-main.author-page, .forum-layout { max-width: 100%; }
  .site-main { flex-direction: column; padding: 0.75rem 0.25rem 0.5rem; gap: 0.5rem; }
  .sidebar { width: 100%; max-width: 100%; order: 2; }
  .content { order: 1; padding: 1rem 0.25rem; border-radius: var(--radius); }
  .content h1 { text-align: center; }
  .author-topics h2 { text-align: center; }
  .auth-page { padding: 0.75rem 0.25rem 0.5rem; }
  .site-footer { padding: 0.5rem 0.25rem; }
}
@media (max-width: 600px) {
  .content { padding: 0.25rem; }
  .site-main, .forum-layout { padding: 0.5rem 0.25rem 0.25rem; }
  .forum-main .content { padding: 0.25rem; }
  .author-topics h2 { font-size: 1.25rem; margin-bottom: 1rem; }
  .author-topic-card { padding: 1rem 0.75rem 1.25rem; }
  .author-topic-card h3 { font-size: 1.15rem; }
  .author-topic-card .topic-description { font-size: 1rem; line-height: 1.6; }
}
@media (max-width: 400px) {
  .site-main, .forum-layout { padding: 0.25rem 0.25rem 0.15rem; }
  .content { padding: 0.5rem 0.25rem; }
  .site-main.full-width, .site-main.author-page { padding: 0.25rem 0.25rem 0.15rem; }
  .author-topics h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
  .author-topic-card { padding: 0.75rem 0.5rem 1rem; }
  .author-topic-card h3 { font-size: 1.05rem; }
  .author-topic-card .topic-description { font-size: 0.95rem; line-height: 1.55; }
}

/* ── Panorama relief background ─────────────────────────────────────────── */
#nature-bg {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -100;
  background-image: url('/images/bg/panorama-relief.png');
  background-size: cover;
  background-position: center;
  opacity: 0.55;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* ── Forum categories bar ── */
.forum-categories-bar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.forum-cat-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-content);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.forum-cat-pill:hover { background: var(--blue); color: var(--accent); border-color: var(--border-accent); }
.forum-cat-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Forum toolbar (search + sort) ── */
.forum-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.forum-sort-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.forum-sort-tab {
  padding: 0.35rem 0.625rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--bg-content);
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.forum-sort-tab:hover { background: var(--blue); color: var(--accent); border-color: var(--border-accent); }
.forum-sort-tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-color: var(--border-accent); }

/* ── New topic extras ── */
.new-topic-extras {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.new-topic-extras select,
.new-topic-extras input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.new-topic-extras select:focus,
.new-topic-extras input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}

/* ── Topic category badge ── */
.topic-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  vertical-align: middle;
  border: 1px solid var(--border-accent);
  transition: background 0.2s, color 0.2s;
}
.topic-cat-badge:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Tags ── */
.topic-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.tag-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-content);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.tag-badge:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--border-accent); }

.forum-filter-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.forum-filter-info a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.35rem;
}

/* ── Post avatars ── */
.post-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.post-avatar-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Post quote ── */
.post-quote {
  background: var(--bg-sidebar);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.post-quote-author {
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
}
.post-quote p { margin: 0; }

/* ── Post footer (reactions, quote btn) ── */
.post-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.post-reactions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.post-reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem;
  border-radius: 12px;
  border: none;
  background: var(--brown-soft);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
.post-reaction-btn:hover, .post-reaction-btn.active { background: var(--accent-soft); }
.post-reaction-btn span { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); font-family: 'Inter', sans-serif; }
.post-add-reaction-btn {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: none;
  background: var(--brown-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  opacity: 0.5;
}
.post:hover .post-add-reaction-btn { opacity: 1; }
.post-add-reaction-btn:hover { background: var(--accent-soft); color: var(--accent); }

.post-reaction-picker {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  background: var(--brown);
  padding: 0.35rem;
  border-radius: 8px;
  margin-top: 0.25rem;
}
.post-reaction-picker .reaction-btn {
  background: var(--brown-soft);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  border-radius: 6px;
  transition: background 0.2s;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
.post-reaction-picker .reaction-btn:hover { background: var(--accent-soft); }

.post-quote-btn {
  font-size: 0.75rem !important;
  padding: 0.15rem 0.5rem !important;
  cursor: pointer;
  border: none;
  background: none;
}
.post-report-btn {
  font-size: 0.7rem !important;
  padding: 0.15rem 0.4rem !important;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted) !important;
  opacity: 0.5;
}
.post:hover .post-report-btn { opacity: 1; }

/* ── Reply quote preview ── */
.reply-quote-preview {
  background: var(--bg-sidebar);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  position: relative;
}
.reply-quote-author { font-weight: 600; color: var(--accent); }
.reply-quote-text { display: block; margin-top: 0.15rem; }
.reply-quote-cancel {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.reply-quote-cancel:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Reply extras (attachments) ── */
.reply-extras {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.reply-attach-label {
  cursor: pointer;
}
.reply-attach-preview {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.reply-attach-item {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.reply-attach-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

/* ── Post attachments ── */
.post-attachments {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.post-attach-img img {
  max-width: min(200px, 100%);
  max-height: 150px;
  border-radius: 8px;
  display: block;
}
.post-attach-file {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: var(--blue);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--accent);
}
.post-attach-file:hover { background: var(--blue-soft); }

/* ── Pagination top ── */
.pagination-top { margin-top: 0; margin-bottom: 1rem; padding-top: 0; }

/* ── Forum stats ── */
.forum-center-col > .forum-stats {
  flex-shrink: 0;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.forum-stats h3 {
  display: none;
}
.forum-stats .stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
.forum-stats .stats-list li {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 0;
}
.stats-label { color: var(--text-muted); }
.stats-value { font-weight: 600; color: var(--text); }

/* ── Notifications ── */
.header-notifications,
.header-chat-link {
  position: relative;
  text-decoration: none !important;
}
.header-notif-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notifications-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.notification-item {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.notification-item.unread { background: var(--accent-soft); }
.notification-item a { color: var(--accent); text-decoration: none; font-weight: 500; }
.notification-item a:hover { text-decoration: underline; }
.notification-time { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Members ── */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 0.75rem;
}
.member-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-content);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, box-shadow 0.2s;
}
.member-card:hover { background: var(--bg-sidebar); box-shadow: var(--shadow-md); }
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.member-avatar-letter {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.member-info { min-width: 0; }
.member-info strong { display: block; font-size: 0.9rem; }
.member-meta { font-size: 0.75rem; color: var(--text-muted); }
.member-online-status { display: block; font-size: 0.72rem; margin-top: 0.1rem; }
.member-online { color: #22c55e; font-weight: 600; }
.member-offline { color: var(--text-muted); }
.member-role-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
  text-transform: uppercase;
}

/* ── Author profile ── */
.author-profile-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.author-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.author-avatar-lg.author-avatar-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}
.author-profile-info h1 { margin-bottom: 0.25rem; }
.author-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.author-edit-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}
.author-location, .author-website, .author-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.25rem 0;
}
.author-website a { color: var(--accent); text-decoration: none; }
.author-website a:hover { text-decoration: underline; }
.author-stats-line {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
  font-weight: 500;
}
.role-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.role-form label {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
}
.role-form select {
  padding: 0.25rem 0.625rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}
.author-recent-posts { margin-top: 2rem; }
.author-posts-list { list-style: none; padding: 0; margin: 0; }
.author-posts-list li {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.author-posts-list li a { color: var(--accent); text-decoration: none; }
.author-posts-list li a:hover { text-decoration: underline; }
.author-post-preview { font-size: 0.85rem; color: var(--text-muted); margin: 0.25rem 0 0; }
.author-posts-list time { font-size: 0.75rem; color: var(--text-muted); }

/* ── Profile tabs ── */
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.profile-tab {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.profile-tab:hover { color: var(--accent); }
.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.profile-tab-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  min-width: 1.2em;
  padding: 0.1em 0.4em;
  border-radius: 9999px;
  text-align: center;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.profile-tab-content { margin-top: 1rem; }

@media (max-width: 600px) {
  .profile-tabs { gap: 0.25rem; }
  .profile-tab { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
}

/* ── Edit profile form ── */
.edit-profile-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.edit-profile-form input,
.edit-profile-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-top: 0.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-content);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.edit-profile-form input:focus,
.edit-profile-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.edit-profile-form textarea { resize: vertical; min-height: 60px; }
.edit-profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.edit-password-form {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.edit-password-form h2 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: var(--text);
}
.edit-profile-form .error {
  color: #dc2626;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.edit-profile-form .success {
  color: #16a34a;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ── Markdown content in posts ── */
.post-content-md h1, .post-content-md h2, .post-content-md h3,
.post-content-md h4, .post-content-md h5, .post-content-md h6 {
  margin: 0.75em 0 0.35em;
  font-weight: 600;
}
.post-content-md h1 { font-size: 1.2rem; }
.post-content-md h2 { font-size: 1.1rem; }
.post-content-md h3 { font-size: 1rem; }
.post-content-md p { margin: 0.35em 0; }
.post-content-md ul, .post-content-md ol { padding-left: 1.5rem; margin: 0.35em 0; }
.post-content-md blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.5em 0;
  padding: 0.35em 0.75em;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border-radius: 4px;
}
.post-content-md code {
  background: var(--bg-sidebar);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
}
.post-content-md pre {
  background: var(--bg-sidebar);
  padding: 0.75em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.5em 0;
  border: 1px solid var(--border);
}
.post-content-md pre code { background: none; padding: 0; }
.post-content-md img { max-width: 100%; height: auto; border-radius: 8px; margin: 0.35em 0; }
.post-content-md a { color: var(--accent); text-decoration: underline; }
.post-content-md table { border-collapse: collapse; width: 100%; margin: 0.5em 0; display: block; overflow-x: auto; }
.post-content-md th, .post-content-md td {
  border: 1px solid var(--blue-soft);
  padding: 0.35em 0.5em;
  text-align: left;
  font-size: 0.85rem;
}
.post-content-md th { background: var(--blue); font-weight: 600; }
.post-content-md del { color: var(--text-muted); }
.md-hint { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.md-hint summary { cursor: pointer; font-weight: 500; }
.md-hint p { margin: 0.25em 0; }
.md-hint code { background: var(--blue); padding: 0.1em 0.3em; border-radius: 3px; font-size: 0.85em; }
.post-content-md hr { border: none; border-top: 1px solid var(--blue-soft); margin: 1em 0; }

/* Animated Photo Background Styles */
.photo-animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -100;
  background-image: url('/images/bg/animated-bg.png');
  background-size: cover;
  background-position: center;
}

/* ── Chat Tabs & Direct Messages ── */

.chat-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  grid-column: 1;
  margin-bottom: 0;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.75rem 1rem 0.5rem;
  position: relative;
}
.chat-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-content);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chat-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chat-tab:hover:not(.active) {
  background: var(--blue);
  color: var(--accent);
  border-color: var(--border-accent);
}

.chat-search-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-content);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chat-search-btn:hover,
.chat-search-btn.active {
  background: var(--accent);
  color: #fff;
}

.chat-search-panel {
  background: rgba(255, 255, 255, 0.96);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
@media (min-width: 901px) {
  .chat-search-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
}
.chat-search-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.chat-search-input:focus {
  border-color: var(--accent);
}
.chat-search-results {
  max-height: 240px;
  overflow-y: auto;
}
.chat-search-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.chat-search-item:hover {
  background: var(--blue);
}
.chat-search-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.chat-search-item-author {
  font-weight: 600;
}
.chat-search-item-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.35;
}
.chat-search-item-text mark {
  background: #fef08a;
  border-radius: 2px;
  padding: 0 1px;
}
.chat-search-empty {
  text-align: center;
  padding: 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.dm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 4px;
  vertical-align: middle;
}

.chat-tab-content {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dm-conversations {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.dm-conversations-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.dm-conversation-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--blue-soft);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
}
.dm-conversation-item:hover { background: var(--blue); }
.dm-conversation-item:last-child { border-bottom: none; }

.dm-conv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.dm-conv-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

.dm-conv-body {
  flex: 1;
  min-width: 0;
}
.dm-conv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.dm-conv-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-conv-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dm-conv-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2px;
}
.dm-conv-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.dm-conv-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.dm-chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.dm-chat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--blue-soft);
  margin-bottom: 0.5rem;
}
.dm-back-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.dm-back-btn:hover { background: var(--blue); color: var(--text); }
.dm-chat-partner-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-msg-dm {
  background: none;
  border: none;
  font-size: 0.95rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.chat-msg-dm:hover { color: var(--accent); background: var(--accent-soft); }

@media (max-width: 900px) {
  .chat-tabs { grid-column: 1; }
  #tab-general .chat-container,
  #tab-dm .chat-container { grid-column: 1; }
  #dm-emoji-btn, #dm-emoji-picker { display: none !important; }
}

/* Статичные мобильные страницы (по аналогии с чатом) */
@media (max-width: 900px) {
  html.static-page {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }
  body.static-page-body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.static-page-body .site-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.static-page-body .content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.static-page-body .site-footer {
    display: none;
  }
}

/* ── Chat Modal (edit / confirm) ── */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.chat-modal {
  background: var(--bg-content, #fff);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-lg, 0 8px 30px rgba(0, 0, 0, 0.18));
  width: 100%;
  max-width: 420px;
  padding: 1.25rem;
  animation: chatModalIn 0.15s ease-out;
}
@keyframes chatModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.chat-modal h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}
.chat-modal textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.5rem;
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
  background: var(--bg-content-soft, #f8f9fa);
  color: var(--text, #2d2a26);
}
.chat-modal textarea:focus {
  outline: none;
  border-color: var(--accent, #5a8fc7);
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(90, 143, 199, 0.2));
}
.chat-modal p {
  margin: 0 0 1rem;
  color: var(--text-muted, #555);
}
.chat-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.chat-modal-actions button {
  padding: 0.4rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border, #d0d5dd);
  background: var(--bg-content, #fff);
  color: var(--text, #2d2a26);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
}
.chat-modal-actions .chat-modal-ok {
  background: var(--accent, #5a8fc7);
  color: #fff;
  border-color: var(--accent, #5a8fc7);
}
.chat-modal-actions .chat-modal-danger {
  background: #d9534f;
  color: #fff;
  border-color: #d9534f;
}

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

