:root {
  color-scheme: dark;
  --bg: #060606;
  --panel: rgba(16, 16, 22, 0.9);
  --panel-strong: rgba(22, 22, 28, 0.95);
  --border: rgba(255,255,255,0.08);
  --text: #f4f4f4;
  --muted: #9ea3b2;
  --accent: #ff3b3b;
  --accent-2: #ff7d4d;
  --shadow: 0 20px 45px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(255, 59, 59, 0.13), transparent 28%), var(--bg);
  color: var(--text);
}

body.forum-page {
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255,59,59,0.12), transparent 35%), var(--bg);
}

.page-shell {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compact-shell { width: min(760px, calc(100% - 2rem)); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  background: rgba(10,10,14,0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 1rem;
  z-index: 20;
}

.brand { display: flex; flex-direction: column; align-items: flex-start; text-decoration: none; color: var(--text); }
.brand-mark { font-family: 'Great Vibes', cursive; font-size: 1.7rem; line-height: 1; color: #fff; }
.brand-sub { font-size: 0.7rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); }
.topnav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.topnav a.active, .topnav a:hover { color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 0.65rem; }
.primary-btn, .ghost-btn, .text-link, button { font: inherit; }
.primary-btn {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255,59,59,0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(255,59,59,0.35); }
.ghost-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
}

.forum-main { padding: 1.4rem 0 0; flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.hero-card, .card { background: linear-gradient(135deg, rgba(18,18,23,0.94), rgba(12,12,17,0.96)); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.hero-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.6rem; margin-bottom: 1.2rem; }
.eyebrow { margin: 0 0 0.3rem; font-size: 0.74rem; letter-spacing: 0.35em; text-transform: uppercase; color: var(--accent); }
.hero-card h1 { margin: 0 0 0.5rem; font-size: clamp(1.35rem, 2.3vw, 2.1rem); }
.hero-copy { color: var(--muted); margin: 0; max-width: 560px; }
.hero-panel { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 0.7rem; min-width: min(320px, 100%); }
.stat-pill { padding: 0.85rem 0.9rem; border-radius: 18px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.2rem; }
.stat-pill strong { font-size: 1.1rem; }
.stat-pill span { font-size: 0.75rem; color: var(--muted); }

.forum-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; flex: 1; overflow: hidden; }
.content-column { display: flex; flex-direction: column; gap: 1rem; overflow: hidden; }
.card { padding: 1rem 1.1rem; }
.card.categories-card { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin-bottom: 0.8rem; }
.card-head h2, .card-head h1 { margin: 0; font-size: 1.05rem; }
.text-link { color: var(--accent); text-decoration: none; }
.categories-list { display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; padding-right: 4px; }
.topic-list, .posts-list { display: flex; flex-direction: column; gap: 0.7rem; }
.category-item { padding: 0; border-radius: 0; background: none; border: none; border-bottom: 1px solid var(--border); }
.category-item:last-child { border-bottom: none; }
.topic-item, .post-item { padding: 0.9rem 1rem; border-radius: 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); }
.category-item h3, .topic-item h3, .post-item h3 { margin: 0; font-size: 1.05rem; }
.category-meta, .topic-meta, .post-meta { font-size: 0.82rem; color: var(--muted); }

/* Залипающий заголовок раздела при скролле внутри */
.category-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0.6rem;
  cursor: pointer;
  background: rgba(18, 18, 23, 0.95);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  transition: background 0.2s ease;
}
.category-header-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.category-content-container {
  padding: 1rem 0.6rem;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border);
}
.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; color: var(--muted); }
.search-form { display: flex; flex-direction: column; gap: 0.6rem; }
.search-form input, .auth-form input, .composer textarea { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); padding: 0.8rem 0.95rem; }
.search-form button { border: none; border-radius: 12px; padding: 0.75rem; background: rgba(255,255,255,0.08); color: white; cursor: pointer; }
.auth-card { max-width: 480px; margin: 0 auto; }
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.4rem; color: var(--muted); }
.form-link { text-align: center; margin: 0; }
.form-link a { color: var(--accent); text-decoration: none; }
.composer { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.9rem; }
.composer textarea { min-height: 120px; resize: vertical; }
.post-item strong { color: #fff; }

@media (max-width: 860px) {
  .topbar { border-radius: 20px; flex-wrap: wrap; justify-content: center; }
  .forum-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 1rem, 100%); }
  .topnav { justify-content: center; }
  .hero-panel { grid-template-columns: 1fr; }
  .card, .hero-card { padding: 0.95rem; }
}
