/* ============================================================
   SOCIALIST UNION — Единая таблица стилей
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,700;1,400&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: "pobeda";
  src: url("fonts/Rpobeda.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --paper: #f9e9c8;
  --ink: #2b1d10;
  --red: #9a2a2a;
  --red-dark: #6b1d1d;
  --border: #c9a97a;
  --surface: rgba(249, 233, 200, 0.9);
  --surface-alt: rgba(249, 233, 200, 0.55);
  --input-bg: #ffffff;
  --muted: #666666;
  --nav-bg: var(--paper);
  --nav-link-bg: rgba(249, 233, 200, 0.7);
}

[data-theme="dark"] {
  --paper: #140e06;
  --ink: #d4bc8e;
  --red: #c04040;
  --red-dark: #8b2a2a;
  --border: #4a3020;
  --surface: rgba(35, 22, 10, 0.95);
  --surface-alt: rgba(30, 18, 8, 0.8);
  --input-bg: #1e1408;
  --muted: #8a7a60;
  --nav-bg: #0f0b04;
  --nav-link-bg: rgba(30, 18, 8, 0.85);
}

body {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.7;
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  -webkit-text-size-adjust: 100%;
}

/* ── Фоновая текстура бумаги ── */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" opacity="0.03"><rect width="100%" height="100%" fill="white"/><path d="M0,0 L200,200 M200,0 L0,200" stroke="%239a2a2a" stroke-width="1"/></svg>');
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.3s;
}

/* ============================================================
   ШАПКА
   ============================================================ */
.header-banner {
  font-family: "pobeda", "Times New Roman", serif;
  background: var(--red);
  color: white;
  padding: 15px 0px;
  text-align: center;
  font-size: 7.8rem;
  letter-spacing: 5px;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 0px;
  position: relative;
  transform: scaleY(0.85);
  transform-origin: center;
}

.header-banner::after {
  content: "";
  display: block;
  width: 80%;
  height: 2px;
  background: repeating-linear-gradient(to right,
      white,
      white 10px,
      transparent 10px,
      transparent 20px);
  margin: 10px auto 0;
}

/* ── Для страниц с кнопкой переключателя (roadmap) ── */
.header-container {
  position: relative;
  margin-bottom: 20px;
}

.header-container .header-banner {
  margin-bottom: 0;
}

/* ============================================================
   НАВИГАЦИЯ
   ============================================================ */
nav {
  background: var(--nav-bg);
  border-bottom: 2px double var(--red);
  padding: 8px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;

}

.nav-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
  flex: 1;
  padding: 0 13px;
  transform: scaleY(0.90);

}

.nav-center a {
  font-family: "pobeda", "Times New Roman", serif;
  display: inline-flex;
  color: var(--red);
  text-decoration: none;
  font-weight: bold;
  padding: 10px 14px;
  border: 1px solid var(--red);
  background: var(--nav-link-bg);
  position: relative;
  overflow: hidden;
  transition: none;
  padding-right: 9px;
  letter-spacing: 0.07em;
  font-size: 1.8rem;
  transform: scaleY(0.86);
}

.nav-center a:hover,
.nav-center a.active {
  background: var(--red);
  color: white;
}

/* ── Правая часть: авторизация ── */
.nav-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transform: scaleY(0.90);

}

.auth-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-auth {
  font-family: "pobeda", "Times New Roman", serif;
  padding: 8px 15px;
  color: var(--red);
  text-decoration: none;
  font-weight: bold;
  border: 1px solid var(--red);
  background: var(--nav-link-bg);
  position: relative;
  overflow: hidden;
  transition: none;
  white-space: nowrap;
  letter-spacing: 0.07em;
  font-size: 1.8rem;
  transform: scaleY(0.86);
  padding-right: 9px;
}

.nav-auth:hover {
  background: var(--red) !important;
  color: white !important;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--red-dark);
  padding: 5px 10px;
  border-right: 1px solid var(--border);
  margin-right: 5px;
}

.username {
  font-weight: bold;
  color: var(--red);
}

.user-role {
  font-size: 0.8rem;
  opacity: 0.8;
  text-transform: uppercase;
}

/* ── Эффект печатной машинки ── */
.nav-center a::before,
.nav-auth::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

.nav-center a:hover::before,
.nav-auth:hover::before {
  animation: typewriter 0.6s linear forwards;
}

/* ── Левая часть: переключатель темы ── */
.nav-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px;
  /* ← те же отступы что у .nav-center a */
  width: 53px;
  /* ← убираем фиксированный размер */
  height: 53px;
  background: var(--nav-link-bg);
  border: 1px solid var(--red);
  color: var(--red);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  position: relative;
  overflow: hidden;
  font-size: 1.8rem;

}

.theme-toggle:hover {
  background: var(--red);
  color: white;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

.theme-toggle:hover::before {
  animation: typewriter 0.6s linear forwards;
}

/* ── Кнопка переключения языка (roadmap) ── */
.lang-switch {
  font-family: "pobeda", "Times New Roman", serif;
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: inline-block;
  color: var(--red);
  text-decoration: none;
  font-weight: bold;
  padding: 8px 15px;
  border: 1px solid var(--red);
  background: rgba(249, 233, 200, 0.9);
  overflow: hidden;
  font-size: 0.9rem;
  white-space: nowrap;
  z-index: 5;
}

.lang-switch:hover {
  background: var(--red-dark);
  color: white;
}

.lang-switch::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

.lang-switch:hover::before {
  animation: typewriter 0.6s linear forwards;
}

@keyframes typewriter {
  to {
    left: 100%;
  }
}

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px;
  font-weight: 400;
}

main p {
  text-align: justify;
  font-size: 1rem;
  -webkit-hyphens: auto;
}

.content-image {
  margin: 24px 0;
  width: 100%;
}

.content-image img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  /* опционально — рамка в стиле сайта */
}

.content-image figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
}

h1,
h2,
h3 {
  color: var(--red-dark);
  margin: 25px 0 15px;
  text-align: center;
}

h1 {
  font-size: 2.2rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ── Герой-заголовок на главной ── */
.hero-title {
  font-size: 38px;
  letter-spacing: 0.1em;
  text-align: center;
  margin: 0px 0 15px;
}

h2 {
  font-size: 1.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

p {
  font-size: 1rem;
  margin-bottom: 1.2rem;

}

ul {
  padding-left: 2.5rem;
  margin-bottom: 1.2rem;
}

ul li {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

hr {
  margin-top: 20px;
  /* Отступ сверху */
  margin-bottom: 20px;
  /* Отступ снизу */
  border: 0;
  /* Убираем стандартную рамку браузера */
  border-top: 2px solid var(--border);
  /* Рисуем свою красивую линию */
  width: 100%;
  /* Можно ограничить ширину линии */
}

/* ── Кнопки ── */
.btn {
  display: inline-block;
  background: var(--red);
  color: white;
  padding: 10px 25px;
  text-decoration: none;
  font-weight: bold;
  border: 2px solid var(--red-dark);
  margin: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.btn::after {
  content: "■";
  position: absolute;
  right: 8px;
  top: 45%;
  transform: translateY(-40%) scaleY(1.176);
  /* 1/0.85 ≈ 1.176 — компенсируем сжатие body */
  opacity: 0;
  font-size: 0.8rem;
  line-height: 1;
}

.btn:hover::after {
  animation: blink 1s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ============================================================
   ГАЛЕРЕЯ СКРИНШОТОВ
   ============================================================ */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.screenshot {
  border: 2px solid var(--border);
  height: 200px;
  background: #ddd;
  cursor: pointer;
  transition: transform 0.2s;
  overflow: hidden;
  /* ✅ Обрезаем всё что выходит за границы */
  position: relative;
}

.screenshot img {
  width: 100%;
  /* ✅ Растягиваем на всю ширину */
  height: 100%;
  /* ✅ Растягиваем на всю высоту */
  object-fit: cover;
  /* ✅ Сохраняем пропорции, обрезая лишнее */
  display: block;
}

.screenshot:hover {
  transform: scale(1.03);
  box-shadow: 0 0 10px rgba(154, 42, 42, 0.4);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal img {
  max-width: 90%;
  max-height: 90%;
  border: 4px solid white;
}

.modal.active {
  display: flex;
}

/* ============================================================
   ФОРМЫ (общие)
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
  color: var(--red-dark);
  font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  background: white;
  font-family: inherit;
  font-size: inherit;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.message {
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
  text-align: center;
  display: none;
}

.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ============================================================
   СТРАНИЦА ВХОДА / РЕГИСТРАЦИИ
   ============================================================ */
.auth-container {
  max-width: 400px;
  margin: 40px auto;
  padding: 30px;
  border: 2px solid var(--border);
  background: rgba(249, 233, 200, 0.9);
}

.btn-auth {
  display: block;
  background: var(--red);
  color: white;
  border: none;
  padding: 12px 25px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
}

.btn-auth:hover {
  background: var(--red-dark);
}

.tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  background: rgba(201, 169, 122, 0.3);
  font-family: inherit;
  font-weight: bold;
  color: var(--ink);
}

.tab.active {
  background: var(--red);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.auth-user-info {
  text-align: center;
  margin: 20px 0;
}

/* ============================================================
   БЛОГ
   ============================================================ */
.post-form {
  background: rgba(249, 233, 200, 0.9);
  border: 2px solid var(--red);
  padding: 20px;
  margin: 30px 0;
  display: none;
}

.post-form h2 {
  margin-top: 0;
}

.btn-blog {
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  margin-right: 10px;
  font-weight: bold;
}

.btn-blog:hover {
  background: var(--red-dark);
}

.create-post-btn {
  margin-bottom: 30px;
  text-align: center;
}

.post {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 14px 18px 10px;
  background: rgba(249, 233, 200, 0.55);
  box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.07);
}

.post h2 {
  text-align: left;
  margin: 0 0 6px 0;
  font-size: 1.9rem;
}

.post-meta {
  color: #666;
  font-size: 0.88em;
  margin-bottom: 8px;
}

.post-content {
  margin-bottom: 8px;
}

.post-images-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.post-img {
  max-width: 280px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-img:hover {
  transform: scale(1.04);
  box-shadow: 0 0 10px rgba(154, 42, 42, 0.45);
}

/* Кнопка удаления — крестик в кружке (галерея скриншотов и превью) */
.screenshot-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(120, 20, 20, 0.82);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
  z-index: 5;
  padding: 0;
}

.screenshot-delete-btn:hover {
  background: rgba(180, 20, 20, 0.97);
}

.screenshot:hover .screenshot-delete-btn,
.preview-item:hover .screenshot-delete-btn,
.post-img-wrap:hover .screenshot-delete-btn {
  opacity: 1;
}

/* Обёртка для картинок в ленте постов */
.post-img-wrap {
  position: relative;
  display: inline-block;
}

.admin-controls {
  margin-top: 8px;
  display: none;
}


/* ── Статистика поста (просмотры + комментарии) ── */
.post-stats {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.83rem;
}

.post-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.75;
}

/* ── Бейдж уведомлений на кнопке Блог ── */
.blog-nav-wrap {
  position: relative;
  display: inline-flex;
}

.blog-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 19px;
  height: 19px;
  background: var(--red);
  color: #fff;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: bold;
  font-family: "JetBrains Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
  z-index: 20;
  border: 2px solid var(--paper);
  line-height: 1;
  transform: scaleY(1.163) !important;
}

/* ── Комментарии ── */
.comments-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.comments-count {
  font-size: 1.0rem;
  color: var(--red-dark);
  font-weight: bold;
}

/* ── Статистика в шапке комментариев ── */
.post-header-stats {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.post-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 1.0rem;
  color: var(--red-dark);
  font-weight: bold;
}

.comment-form {
  margin-top: 10px;
}

.comment-form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.comment-input-wrapper {
  flex: 1;
  position: relative;
}

.comment-form textarea {
  min-height: 44px;
  max-height: 120px;
  margin-bottom: 0;
  width: 100%;
  padding: 10px 70px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: white;
  font-family: inherit;
  font-size: inherit;
  resize: none;
  transition: border-color 0.3s;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(154, 42, 42, 0.1);
}

.comment-form-buttons {
  display: none;
}

.comment-submit-arrow {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  background: transparent;
  color: #bbb;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  padding: 0;
}

.comment-submit-arrow:hover {
  color: var(--red);
}

.comment-char-count {
  position: absolute;
  right: 36px;
  bottom: 12px;
  font-size: 0.72rem;
  color: #bbb;
  pointer-events: none;
}

.comment-char-count.warning {
  color: #f39c12;
}

.comment-char-count.error {
  color: #e74c3c;
}

.comment {
  background: rgba(249, 233, 200, 0.5);
  border: 1px solid var(--border);
  padding: 10px;
  margin-bottom: 15px;
  position: relative;
  animation: fadeIn 0.3s ease-in;
}

/* Стили только для корневых комментариев (не вложенных) */
.comments-list>.comment {
  background: rgba(249, 233, 200, 0.5);
  border: 1px solid var(--border);
}

/* Вложенные комментарии — без рамки и фона */
.comment-thread .comment {
  background: transparent;
  border: none;
  padding: 8px 0 0 0;
  margin-bottom: 8px;
}

/* Разделитель между вложенными комментариями */
.comment-thread .comment+.comment {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

/* Контейнер для вложенных комментариев — с отступом слева */
.comment-thread {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

[data-theme="dark"] .comment-thread .comment {
  background: transparent;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.comment-author {
  font-weight: bold;
  color: var(--red-dark);
}

.comment-admin {
  background: var(--red);
  color: white;
  padding: 2px 8px;
  font-size: 0.8rem;
  margin-left: 10px;
}

.comment-date {
  color: #666;
  font-size: 0.9rem;
}

.comment-content {
  line-height: 1.5;
  margin-bottom: 5px;
  white-space: pre-line;
  word-break: break-word;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.comment-delete-btn {
  background: transparent;
  border: 1px solid #dc3545;
  color: #dc3545;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.comment-delete-btn:hover {
  background: #dc3545;
  color: white;
}

.reply-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: #666;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  margin-left: 10px;
  transition: all 0.2s;
}

.reply-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.no-comments {
  text-align: center;
  padding: 10px;
  color: #666;
  font-style: italic;
}

.login-to-comment {
  text-align: center;
  padding: 20px;
  background: rgba(154, 42, 42, 0.05);
  border: 1px dashed var(--red);
  margin-top: 20px;
}

.login-to-comment a {
  color: var(--red);
  font-weight: bold;
  text-decoration: none;
}

.login-to-comment a:hover {
  text-decoration: underline;
}

.comment-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(154, 42, 42, 0.3);
  border-radius: 50%;
  border-top-color: var(--red);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.btn-admin {
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  margin-right: 10px;
  font-weight: bold;
}

.btn-admin:hover {
  background: var(--red-dark);
}

.posts-list {
  margin-top: 40px;
}

.post-item {
  border: 1px solid var(--border);
  padding: 15px;
  margin-bottom: 15px;
  background: rgba(249, 233, 200, 0.3);
}

.post-actions {
  margin-top: 10px;
}

/* ============================================================
   СТРАНИЦА 404
   ============================================================ */
.error-container {
  max-width: 800px;
  margin: 60px auto;
  padding: 40px;
  text-align: center;
  background: rgba(249, 233, 200, 0.9);
  border: 3px solid var(--red);
  box-shadow: 0 0 20px rgba(154, 42, 42, 0.2);
}

.error-code {
  font-size: 8rem;
  color: var(--red);
  margin: 0;
  text-shadow: 3px 3px 0 #000;
  line-height: 1;
}

.error-title {
  font-size: 2.5rem;
  color: var(--red-dark);
  margin: 20px 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.error-description {
  font-size: 1.2rem;
  margin: 25px 0;
  line-height: 1.6;
}

.error-details {
  background: rgba(201, 169, 122, 0.2);
  padding: 20px;
  margin: 30px 0;
  border-left: 4px solid var(--red);
  text-align: left;
}

.error-details ul {
  padding-left: 1.5rem;
  margin-top: 10px;
}

.error-actions {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.error-link {
  display: inline-block;
  padding: 12px 30px;
  background: var(--red);
  color: white;
  text-decoration: none;
  border: 2px solid var(--red-dark);
  font-weight: bold;
  font-size: 1.1rem;
  font-family: inherit;
}

.error-link:hover {
  background: var(--red-dark);
}

.error-link-home {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
}

.error-link-home:hover {
  background: var(--red);
  color: white;
}

/* ============================================================
   ROADMAP
   ============================================================ */
.roadmap-wrapper {
  max-width: 1400px;
  margin: 20px auto;
  padding: 10px;
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 60px 60px;
  position: relative;
}

.milestone {
  background: rgba(249, 233, 200, 0.95);
  border: 2px solid var(--border);
  padding: 18px 20px 16px;
  min-height: 140px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.milestone h3 {
  color: var(--red-dark);
  margin-bottom: 6px;
  font-size: 1.15rem;
  text-align: left;
}

.milestone .date {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: .85rem;
  font-style: italic;
  color: var(--red);
}

.milestone::after {
  content: "➜";
  position: absolute;
  right: -45px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
}

.milestone.down::before {
  content: "➜";
  position: absolute;
  bottom: -48px;
  left: 50%;
  transform: translateX(-50%) rotate(90deg);
  color: var(--red);
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
}

.milestone.end-row::after {
  display: none;
}

.reverse::after {
  content: "➜";
  position: absolute;
  left: -45px;
  right: auto;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  color: var(--red);
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
}

/* ============================================================
   ПОДВАЛ
   ============================================================ */
footer {
  text-align: center;
  padding: 25px 0 15px;
  color: var(--red-dark);
  font-size: 1.2rem;
  border-top: 1px dashed var(--red);
  margin-top: 30px;
}

/* ============================================================
   Drag-and-Drop
   ============================================================ */
.upload-section {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 20px;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.3);
}

.drop-zone {
  border: 2px dashed var(--red);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--paper);
}

.drop-zone.dragover {
  background: rgba(154, 42, 42, 0.1);
  border-style: solid;
  transform: scale(1.01);
}

.drop-zone-content p {
  font-family: "Times New Roman", serif;
  font-weight: bold;
  color: var(--red);
  margin-top: 10px;
}

.preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ============================================================
ИЗОБРАЖЕНИЯ В ПОСТАХ
============================================================ */
.post-images-section {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid var(--border);
  background: rgba(249, 233, 200, 0.5);
}

.post-images-section h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--red-dark);
}

.post-images {
  margin: 15px 0;
  padding: 10px 0;
}

.post-image-item {
  position: relative;
  display: inline-block;
  margin: 5px;
}

.post-image-item img {
  max-width: 200px;
  max-height: 150px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-image-item img:hover {
  opacity: 0.8;
}

.blog-feed {
  max-width: 840px;
  margin: 0 auto;
}

/* ── Диалог удаления поста ── */
.delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-dialog {
  background: var(--paper);
  border: 2px solid var(--red);
  padding: 24px 32px;
  text-align: center;
  min-width: 240px;
}

.delete-dialog p {
  font-size: 1.1rem;
  margin-bottom: 16px;
  text-indent: 0;
}

.delete-dialog-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Инлайн-редактирование поста ── */
.inline-edit-form {
  margin: 6px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-edit-title {
  width: 100%;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: bold;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
}

.inline-edit-content {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  resize: vertical;
}

.inline-edit-btns {
  display: flex;
  gap: 8px;
}



/* Обновление preview-container для постов */
#post-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

#post-preview-container .preview-item {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
}

#post-preview-container .preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 40px auto;
}

.contact-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-btn {
  width: 260px;
  margin: 0;
  font-size: 0.95em;
  text-align: center;
}

.copy-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 4px 12px;
  font-size: 0.85em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.copy-tooltip.visible {
  opacity: 1;
}

/* ============================================================
   ТЁМНАЯ ТЕМА — переопределение хардкодных цветов
   ============================================================ */

/* Формы и инпуты */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--border);
}

[data-theme="dark"] .inline-edit-title,
[data-theme="dark"] .inline-edit-content,
[data-theme="dark"] .comment-form textarea {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--border);
}

/* Посты и карточки */
[data-theme="dark"] .post {
  background: var(--surface-alt);
  border-color: var(--border);
}

[data-theme="dark"] .post-form {
  background: var(--surface);
}

[data-theme="dark"] .auth-container {
  background: var(--surface);
}

[data-theme="dark"] .error-container {
  background: var(--surface);
}

[data-theme="dark"] .milestone {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .post-item {
  background: rgba(30, 18, 8, 0.5);
}

[data-theme="dark"] .upload-section {
  background: rgba(0, 0, 0, 0.2);
  border-color: var(--border);
}

[data-theme="dark"] .drop-zone {
  background: var(--input-bg);
}

[data-theme="dark"] .post-images-section {
  background: var(--surface-alt);
  border-color: var(--border);
}

[data-theme="dark"] .delete-dialog {
  background: var(--paper);
}

/* Мелкий текст */
[data-theme="dark"] .post-meta,
[data-theme="dark"] .comment-date,
[data-theme="dark"] .no-comments,
[data-theme="dark"] .reply-btn {
  color: var(--muted);
}

[data-theme="dark"] .reply-btn {
  border-color: var(--border);
}

/* Вкладки */
[data-theme="dark"] .tab {
  background: rgba(50, 30, 10, 0.5);
  color: var(--ink);
}

[data-theme="dark"] .tab.active {
  background: var(--red);
  color: white;
}

/* Комментарии */
[data-theme="dark"] .comment {
  background: var(--surface-alt);
  border-color: var(--border);
}

/* Скриншоты */
[data-theme="dark"] .screenshot {
  background: #1a1208;
  border-color: var(--border);
}

/* Сообщения */
[data-theme="dark"] .success {
  background: #0d2e17;
  color: #6ee08a;
  border-color: #1a5c30;
}

[data-theme="dark"] .error {
  background: #2e0d10;
  color: #f08a8e;
  border-color: #5c1a1e;
}

/* Превью */
[data-theme="dark"] .preview-item {
  border-color: var(--border);
}

/* User info в nav */
[data-theme="dark"] .user-info {
  color: var(--ink);
}

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: var(--nav-link-bg);
  border: 1px solid var(--red);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  order: 99;
}

.burger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--red);
  transition: transform 0.3s, opacity 0.3s;
}

.burger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger-btn.open span:nth-child(2) {
  opacity: 0;
}

.burger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

/* ── Средние экраны / планшеты ── */
@media (max-width: 1100px) {
  .chat-layout {
    flex-direction: column;
    align-items: center;
  }

  .chat-rules {
    width: 100%;
    max-width: 600px;
    position: static;
    order: 1;
    margin-right: 0;
    margin-bottom: 15px;
  }

  .chat-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 800px;
    order: 2;
  }
}

@media (max-width: 900px) {
  .roadmap {
    grid-template-columns: 1fr 1fr;
    gap: 25px;
  }

  .milestone::after,
  .milestone.reverse::after,
  .milestone.down::before {
    display: none;
  }

  .milestone {
    padding: 14px 16px;
    min-height: auto;
  }

  .milestone h3 {
    font-size: 1rem;
  }

  .ideas-sidebar {
    display: none;
  }

  .nav-center .ideas-nav-wrap {
    width: 100%;
    display: flex;
    position: relative;
  }

  .nav-center .ideas-badge {
    right: 10px;
    top: 50%;
    transform: translateY(-50%) scaleY(1.163) !important;
  }

  /* ── Навигация: бургер-меню для планшетов ── */
  nav {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    min-height: 52px;
    position: sticky;
    top: 0;
  }

  .nav-left {
    order: 1;
    flex-shrink: 0;
  }

  .nav-right {
    order: 2;
    flex-shrink: 0;
    transform: none;
    margin-left: auto;
    padding-right: 8px;
  }

  .burger-btn {
    display: flex;
    order: 3;
    flex-shrink: 0;
  }

  /* Дропдаун-меню */
  .nav-center {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: var(--nav-bg);
    border-bottom: 2px solid var(--red);
    border-top: 1px solid var(--border);
    padding: 8px;
    gap: 4px;
    z-index: 50;
    transform: none;
    max-height: calc(100vh - 52px);
    overflow-y: auto;
  }

  .nav-center .blog-nav-wrap {
    width: 100%;
    display: flex;
  }

  .nav-center .blog-badge {
    right: 10px;
    top: 50%;
    transform: translateY(-50%) scaleY(1.163) !important;
  }

  .nav-center.open {
    display: flex;
  }

  .nav-center a {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 1.1rem;
    transform: none;
  }

  /* Auth-кнопки: компактно */
  .auth-buttons {
    flex-direction: row;
    gap: 5px;
    width: auto;
  }

  .user-info {
    display: none;
  }

  .nav-auth {
    padding: 6px 10px;
    font-size: 0.85rem;
    width: auto;
    max-width: none;
    text-align: center;
    transform: none;
  }

  /* Левый сайдбар и плавающая кнопка скрыты */
  .left-sidebar {
    display: none;
  }

  #float-chat-btn {
    display: none;
  }
}

/* ── Мобильные устройства ── */
@media (max-width: 768px) {

  /* ── Шапка ── */
  .header-banner {
    font-size: 2.8rem;
    letter-spacing: 2px;
    padding: 12px 10px;
    transform: none;
  }

  .header-banner::after {
    width: 90%;
  }

  /* ── Навигация: доп. уточнения для мобильных ── */
  .theme-toggle {
    width: 42px;
    height: 42px;
    padding: 10px;
    font-size: 1.4rem;
  }

  /* ── Основной контент ── */
  main {
    transform: none;
    padding: 10px 12px;
  }

  h1 {
    font-size: 1.6rem;
    letter-spacing: 1px;
  }

  .hero-title {
    font-size: 1.6rem;
    letter-spacing: 0.05em;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.15rem;
  }

  p,
  ul li {
    font-size: 0.95rem;
  }

  ul {
    padding-left: 1.5rem;
  }

  /* ── Форма входа ── */
  .auth-container {
    margin: 15px auto;
    padding: 15px 12px;
    max-width: 100%;
  }

  .btn-auth {
    font-size: 0.95rem;
  }

  /* ── Блог ── */
  .blog-feed {
    padding: 0;
  }

  .post {
    padding: 10px 12px;
  }

  .post h2 {
    font-size: 1.15rem;
  }

  .post-meta {
    font-size: 0.78rem;
  }

  .post-content {
    font-size: 0.93rem;
  }

  .post-img {
    max-width: 100%;
  }

  .post-form {
    padding: 12px;
    margin: 12px 0;
  }

  .inline-edit-form {
    gap: 6px;
  }

  .inline-edit-btns {
    flex-wrap: wrap;
  }

  /* ── Скриншоты ── */
  .screenshots-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .screenshot {
    height: 120px;
  }

  /* ── Roadmap ── */
  .roadmap-wrapper {
    transform: none;
    padding: 5px 8px;
  }

  .roadmap {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }

  .milestone {
    padding: 12px 14px;
    min-height: auto;
  }

  .milestone h3 {
    font-size: 1rem;
  }

  .milestone .desc {
    font-size: 0.9rem;
  }

  /* ── 404 ── */
  .error-container {
    margin: 15px 10px;
    padding: 20px 12px;
  }

  .error-code {
    font-size: 4.5rem;
  }

  .error-title {
    font-size: 1.4rem;
  }

  .error-description,
  .error-details {
    font-size: 0.95rem;
  }

  .error-actions {
    flex-direction: column;
    align-items: center;
  }

  .error-link {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  /* ── Кнопки ── */
  .btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    margin: 5px;
  }

  .btn-blog {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  /* ── Админ-панель ── */
  .admin-container {
    padding: 10px 12px;
  }

  .btn-admin {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  /* ── Контакты ── */
  .contact-btn {
    width: 100%;
    max-width: 280px;
  }

  .contact-list {
    gap: 12px;
    margin: 20px auto;
  }

  /* ── Комментарии ── */
  .comment-thread {
    margin-left: 10px;
    padding-left: 8px;
  }

  .comment-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  .comment-form-row {
    flex-direction: column;
  }

  /* ── Диалог удаления ── */
  .delete-dialog {
    padding: 16px 20px;
    min-width: auto;
    max-width: 90vw;
  }

  /* ── Загрузка ── */
  .upload-section {
    padding: 12px;
  }

  .drop-zone {
    padding: 20px;
  }

  /* ── Идеи ── */
  .idea-card {
    padding: 12px 14px;
  }

  .idea-form {
    padding: 14px;
  }

  .idea-footer {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .ideas-rules-body {
    padding: 12px;
  }

  /* ── Изображения в постах ── */
  .post-image-item img {
    max-width: 140px;
    max-height: 110px;
  }

  /* ── Подвал ── */
  footer {
    font-size: 1rem;
    padding: 20px 0 12px;
  }

  /* ── Переключатель языка (roadmap) ── */
  .lang-switch {
    position: static;
    transform: none;
    display: inline-block;
    margin: 10px auto;
    text-align: center;
  }

  /* ── Модальное окно ── */
  .modal img {
    max-width: 95%;
    max-height: 90%;
  }

  /* ── Плавающая кнопка чата ── */
  .chat-floating-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    bottom: 15px;
    right: 15px;
  }

  /* ── Статистика поста ── */
  .post-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Чат ── */
  .chat-box {
    height: calc(100vh - 200px);
    min-height: 320px;
  }

  .chat-layout {
    flex-direction: column;
  }

  .chat-rules {
    width: 100%;
    position: static;
    order: -1;
    margin-bottom: 15px;
  }

  .chat-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 800px;
    order: 2;
  }

  .chat-wrap {
    padding: 0 8px;
  }

  .chat-head {
    padding: 8px 10px;
  }

  .chat-messages {
    padding: 8px 10px;
  }

  .chat-footer {
    padding: 8px 10px;
  }

  .chat-input-row {
    gap: 6px;
  }

  .chat-textarea {
    padding: 8px 48px 8px 10px;
    font-size: 0.88rem;
  }

  .chat-msg-body {
    font-size: 0.88rem;
  }

  .chat-reply-text {
    max-width: 200px;
  }

  /* ── Reply input wrapper ── */
  .reply-input-wrapper {
    flex-direction: column;
  }

  .reply-input-wrapper textarea {
    padding: 8px 36px 8px 10px;
  }
}

/* ── Очень маленькие экраны ── */
@media (max-width: 480px) {
  .header-banner {
    font-size: 2rem;
    letter-spacing: 1px;
    padding: 10px 6px;
  }

  .header-banner::after {
    margin-top: 6px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .hero-title {
    font-size: 1.3rem;
    letter-spacing: 0.03em;
  }

  h2 {
    font-size: 1.15rem;
  }

  h3 {
    font-size: 1.05rem;
  }

  nav {
    padding: 4px 8px;
  }

  .theme-toggle {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .nav-auth {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  main {
    padding: 8px 10px;
  }

  .btn {
    padding: 7px 12px;
    font-size: 0.85rem;
    margin: 4px;
  }

  .contact-btn {
    max-width: 100%;
    width: 100%;
  }

  .post h2 {
    font-size: 1.05rem;
  }

  .screenshots-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
  }

  .screenshot {
    height: 100px;
  }

  .error-code {
    font-size: 3.5rem;
  }

  .error-title {
    font-size: 1.2rem;
  }

  /* ── Комментарии: уменьшаем отступы вложенности ── */
  .comment-thread {
    margin-left: 6px;
    padding-left: 6px;
    border-left-width: 1px;
  }

  .comment-admin {
    margin-left: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
  }

  /* ── Идеи: голосование на всю ширину ── */
  .idea-votes {
    width: 100%;
  }

  .vote-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 0.85rem;
  }

  /* ── Форма идей ── */
  .idea-form h2 {
    font-size: 1.05rem;
  }

  /* ── Бейджи ── */
  .blog-badge,
  .ideas-badge {
    min-width: 16px;
    height: 16px;
    font-size: 0.6rem;
  }

  /* ── Чат ── */
  .chat-box {
    height: calc(100vh - 180px);
    min-height: 280px;
  }

  .chat-head-title {
    font-size: 0.78rem;
  }

  .chat-head-meta {
    font-size: 0.65rem;
  }

  .chat-msg-author {
    font-size: 0.8rem;
  }

  .chat-msg-time {
    font-size: 0.65rem;
  }

  .chat-send-arrow {
    font-size: 0.95rem;
  }

  .chat-char {
    font-size: 0.6rem;
    right: 30px;
  }

  .chat-textarea {
    padding: 7px 40px 7px 8px;
    font-size: 0.85rem;
    min-height: 38px;
  }

  .chat-hint {
    font-size: 0.62rem;
  }

  .chat-rules-body {
    padding: 10px;
    font-size: 0.78rem;
  }

  .chat-reply-text {
    max-width: 140px;
  }
}

/* ── Экстремально маленькие экраны ── */
@media (max-width: 360px) {
  .header-banner {
    font-size: 1.6rem;
    letter-spacing: 0;
  }

  h1 {
    font-size: 1.15rem;
  }

  h2 {
    font-size: 1rem;
  }

  .nav-center a {
    font-size: 0.95rem;
    padding: 8px 10px;
  }

  .theme-toggle {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .burger-btn {
    width: 38px;
    height: 38px;
  }

  .burger-btn span {
    width: 18px;
  }

  .nav-auth {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .error-code {
    font-size: 3rem;
  }
}

/* ============================================================
   КАСТОМНЫЕ СКРОЛЛБАРЫ
   ============================================================ */

/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--paper);
  border-left: 1px solid var(--border);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 1px solid var(--paper);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

::-webkit-scrollbar-corner {
  background: var(--paper);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--paper);
}

*:hover {
  scrollbar-color: var(--red) var(--paper);
}

/* ── Вложенные комментарии и чат ── */
.comment-thread {
  margin-left: 20px;
  border-left: 2px dashed var(--border);
  padding-left: 15px;
  margin-top: 10px;
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85rem;
}

.comment-action-btn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  padding: 0;
  transition: color 0.2s;
}

.comment-action-btn:hover {
  text-decoration: underline;
  color: var(--red-dark);
}

.comment-children-container {
  transition: max-height 0.3s ease-out;
  overflow: hidden;
}

.comment-children-container.collapsed {
  display: none;
}

/* ── Плавающая кнопка чата для страницы блога ── */
.chat-floating-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: var(--red);
  color: var(--paper);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  border: 2px solid var(--border);
  transition: transform 0.2s, background 0.2s;
}

.chat-floating-btn:hover {
  background: var(--red-dark);
  transform: scale(1.05);
}

.comment-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.send-reply-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
}

.send-reply-btn:hover {
  background: var(--red-dark);
}

.send-reply-btn i {
  font-size: 0.9rem;
}

/* Смещение для текста, чтобы не залезал под кнопку */
.reply-input {
  resize: vertical;
  width: 100%;
}

/* ── Кнопка отправки ответа (аналогично основному комментарию) ── */
.reply-input-wrapper {
  position: relative;
  margin-top: 10px;
}

.reply-textarea {
  width: 100%;
  min-height: 40px;
  max-height: 100px;
  padding: 8px 45px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
}

.reply-textarea:focus {
  outline: none;
  border-color: var(--red);
}

.reply-submit-arrow {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  background: transparent;
  color: #bbb;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  padding: 0;
}

.reply-submit-arrow:hover {
  color: var(--red);
}

/* ── Кнопка сворачивания всех комментариев ── */
.toggle-all-comments-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
  margin-left: auto;
}

.toggle-all-comments-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Скрытые комментарии */
.comments-list.collapsed {
  display: none;
}

.comment-thread.collapsed {
  display: none;
}

/* Тёмная тема */
[data-theme="dark"] .reply-textarea {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--border);
}

/* ============================================================
   ЛЕВЫЙ САЙДБАР
   ============================================================ */
/* ============================================================
   ЛЕВЫЙ САЙДБАР (квадратные кнопки с эмодзи)
   ============================================================ */
.left-sidebar {
  position: fixed;
  left: 16px;
  top: 80px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.left-sidebar-btn {
  width: 53px;
  height: 53px;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.35rem;
  box-shadow: 2px 3px 10px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}

.left-sidebar-btn:hover {
  background: var(--red-dark);
  transform: scale(1.12);
}

/* Эффект печатной машинки */
.left-sidebar-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

.left-sidebar-btn:hover::before {
  animation: typewriter 0.6s linear forwards;
}

/* ============================================================
   ГОЛОСОВАНИЕ ЗА ИДЕИ
   ============================================================ */
.idea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* Переопределяем отступ, если actions находятся в футере */
.idea-footer .idea-actions {
  margin-top: 0;
}

.idea-votes {
  display: inline-flex;
  border: 1px solid var(--red);
  background: var(--surface);
}

.vote-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--red);
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s;
}

.vote-btn:last-child {
  border-right: none;
}

.vote-btn:hover {
  background: rgba(154, 42, 42, 0.1);
  color: var(--red);
}

/* Активное состояние кнопки, которую нажал юзер */
.vote-btn.active {
  background: var(--red);
  color: white;
  font-weight: bold;
}

/* Тёмная тема */
[data-theme="dark"] .idea-votes {
  border-color: var(--border);
}

[data-theme="dark"] .vote-btn {
  border-right-color: var(--border);
}

[data-theme="dark"] .vote-btn.active {
  background: var(--red);
  color: white;
}

/* ============================================================
   ЧАТ: ОТВЕТ НА СООБЩЕНИЕ
   ============================================================ */
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(154, 42, 42, 0.08);
  border-bottom: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--ink);
  flex-shrink: 0;
}

.chat-reply-preview {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 10px;
  margin-bottom: 4px;
  background: rgba(154, 42, 42, 0.07);
  border-left: 3px solid var(--red);
  border-radius: 0 3px 3px 0;
}

.chat-reply-author {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--red-dark);
}

.chat-reply-text {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.chat-msg-actions {
  margin-top: 3px;
  display: flex;
  gap: 8px;
}

.chat-reply-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  padding: 0;
  transition: color 0.2s;
  line-height: 1;
}

.chat-reply-btn:hover {
  color: var(--red);
}

/* ============================================================
   СТРАНИЦА ИДЕЙ
   ============================================================ */
.ideas-rules {
  border: 2px solid var(--red);
  margin-bottom: 30px;
  background: var(--surface);
}

.ideas-rules-header {
  background: var(--red);
  color: #fff;
  padding: 10px 16px;
  font-weight: bold;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ideas-rules-header::before {
  content: "📋";
}

.ideas-rules-body {
  padding: 16px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink);
}

.ideas-rules-body p {
  margin: 0 0 8px;
  text-align: justify;
  text-indent: 0;
}

.ideas-rules-body p:last-child {
  margin-bottom: 0;
}

.idea-card {
  border: 1px solid var(--border);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--surface-alt);
  position: relative;
}

.idea-card.idea-own {
  border-color: var(--red);
  border-width: 2px;
}

.idea-card h3 {
  text-align: left;
  font-size: 1.1rem;
  margin: 0 0 6px;
  color: var(--red-dark);
}

.idea-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.idea-content {
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.idea-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.idea-form {
  border: 2px solid var(--red);
  padding: 20px;
  margin-bottom: 30px;
  background: var(--surface);
}

.idea-form h2 {
  text-align: left;
  margin-top: 0;
  font-size: 1.2rem;
}

[data-theme="dark"] .idea-card {
  background: var(--surface-alt);
}

[data-theme="dark"] .idea-form {
  background: var(--surface);
}

/* ── Карточка идеи в режиме обсуждения ── */
.idea-discussion-card {
  margin-bottom: 30px;
}

.idea-discussion-card h2 {
  text-align: left;
  margin: 0 0 8px 0;
  font-size: 1.9rem;
}

/* ── Сворачивание комментариев идей ── */
#idea-comments-list.collapsed .comment {
  display: none;
}

#idea-comments-list.collapsed {
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

#idea-comments-list.collapsed::after {
  content: "Комментарии свёрнуты";
}

/* ── Reply input wrapper для обсуждения идей ── */
.reply-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.reply-input-wrapper textarea {
  flex: 1;
  min-height: 36px;
  max-height: 100px;
  padding: 8px 36px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: white;
  font-family: inherit;
  font-size: inherit;
  resize: none;
  transition: border-color 0.3s;
}

.reply-input-wrapper textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(154, 42, 42, 0.1);
}

[data-theme="dark"] .reply-input-wrapper textarea {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--border);
}

[data-theme="dark"] .idea-discussion-card {
  background: var(--surface-alt);
}

[data-theme="dark"] .idea-discussion-card h2 {
  color: var(--red-dark);
}

/* ============================================================
   ПЛАВАЮЩИЙ САЙДБАР СЛЕВА (YouTube, Ideas)
   ============================================================ */
.left-sidebar {
  position: fixed;
  left: 16px;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 997;
}

.left-sidebar-btn {
  font-family: "pobeda", "Times New Roman", serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 130px;
  padding: 14px 18px;
  color: var(--red);
  text-decoration: none;
  font-weight: bold;
  border: 1px solid var(--red);
  background: var(--nav-link-bg);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.07em;
  font-size: 1.6rem;
  transform: scaleY(0.86);
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.15s, color 0.15s;
}

.left-sidebar-btn:hover,
.left-sidebar-btn:focus {
  background: var(--red);
  color: white;
}

.left-sidebar-btn .sidebar-icon {
  font-size: 1.2rem;
}

/* Эффект печатной машинки (как в навигации) */
.left-sidebar-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

.left-sidebar-btn:hover::before {
  animation: typewriter 0.6s linear forwards;
}

/* Плавающая кнопка чата */
/* ============================================================
   ПЛАВАЮЩАЯ КНОПКА ЧАТА
   ============================================================ */
#float-chat-btn {
  width: 62px;
  height: 62px;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--red-dark);
  font-size: 1.5rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 2px 3px 10px rgba(0, 0, 0, 0.28);
  position: relative;
  overflow: hidden;
  transition: background 0.15s, transform 0.15s;
}

#float-chat-btn:hover {
  background: var(--red-dark);
  transform: scale(1.1);
}

#float-chat-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg,
      transparent, transparent 2px,
      rgba(0, 0, 0, 0.1) 2px, rgba(0, 0, 0, 0.1) 4px);
  animation: typewriter 0.8s linear forwards;
}

#float-chat-btn:hover::before {
  animation: typewriter 0.6s linear forwards;
}

/* Бейдж */
.chat-float-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  background: #fff;
  color: var(--red-dark);
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: bold;
  font-family: "JetBrains Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--red-dark);
  pointer-events: none;
  z-index: 999;
  line-height: 1;
}

/* Тёмная тема */
[data-theme="dark"] .left-sidebar-btn,
[data-theme="dark"] #float-chat-btn {
  background: var(--red);
  border-color: var(--red-dark);
}

/* ============================================================
   ИДЕИ — НОВЫЕ СТИЛИ (счётчик, боковая панель, бейджи)
   ============================================================ */

/* ── Бейдж непрочитанных идей в навигации ── */
.ideas-nav-wrap {
  position: relative;
  display: inline-flex;
}

.ideas-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 19px;
  height: 19px;
  background: var(--red);
  color: #fff;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: bold;
  font-family: "JetBrains Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
  z-index: 20;
  border: 2px solid var(--paper);
  line-height: 1;
  transform: scaleY(1.163) !important;
}

/* ── Счётчик комментариев рядом с кнопкой "Обсудить" ── */
.idea-comment-badge {
  font-weight: bold;
  opacity: 0.85;
}

/* ── Макет идей с боковой панелью ── */
.ideas-layout {
  /* Sidebar is now fixed overlay, layout is just content */
}

.ideas-sidebar {
  position: fixed;
  left: 12px;
  top: 60px;
  /* fallback, updated dynamically via JS */
  width: 160px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0 6px 6px 0;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  z-index: 9;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.10);
}

.ideas-sidebar-header {
  background: var(--red);
  color: white;
  padding: 10px 14px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ideas-sidebar-body {
  padding: 8px 0;
}

.sidebar-idea-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  transition: background 0.15s;
}

.sidebar-idea-item:last-child {
  border-bottom: none;
}

.sidebar-idea-item:hover {
  background: rgba(154, 42, 42, 0.08);
}

.sidebar-idea-title {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--red-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  line-height: 1.3;
}

.sidebar-idea-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.sidebar-label {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.66rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-label-created {
  background: rgba(40, 120, 40, 0.15);
  color: #2a7a2a;
}

.sidebar-label-updated {
  background: rgba(154, 42, 42, 0.15);
  color: var(--red);
}

.sidebar-time {
  white-space: nowrap;
}

.sidebar-comments {
  white-space: nowrap;
}

.ideas-content {
  /* Sidebar is now fixed overlay, content takes full width */
}

/* ── Тёмная тема для новых элементов ── */
[data-theme="dark"] .ideas-sidebar {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .sidebar-idea-item:hover {
  background: rgba(192, 64, 64, 0.1);
}

[data-theme="dark"] .sidebar-label-created {
  background: rgba(100, 200, 100, 0.12);
  color: #6ee08a;
}

[data-theme="dark"] .sidebar-label-updated {
  background: rgba(192, 64, 64, 0.15);
  color: #e07070;
}


/* ============================================================
   ROADMAP EDITING (ADMIN)
   ============================================================ */
.edit-pencil {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 5px;
  margin-left: 5px;
  transition: transform 0.2s, color 0.2s;
  vertical-align: middle;
}

.edit-pencil:hover {
  color: var(--red);
  transform: scale(1.1);
}

.editable-text {
  display: inline-block;
  min-width: 50px;
  outline: none;
  border-radius: 3px;
  border: 1px dashed transparent;
  transition: background 0.2s, border-color 0.2s;
}

.editable-text[contenteditable="true"] {
  background: var(--input-bg);
  border-color: var(--red);
  padding: 2px 6px;
  box-shadow: 0 0 5px rgba(154, 42, 42, 0.2);
}

[data-theme="dark"] .editable-text[contenteditable="true"] {
  background: rgba(0, 0, 0, 0.3);
}

/* Утилита для отображения кастомного confirm */
.delete-overlay.active {
  display: flex !important;
}