/* ==========================================
   ТЕМА RETRO DARK (ЕДИНАЯ ДЛЯ ВСЕГО САЙТА)
   ========================================== */
:root {
  --bg-color: #1d1f21;
  --text-color: #c5c8c6;
  --title-color: #cc6666;
  --sub-color: #969896;
  --link-color: #81a2be;
  --link-hover: #b294bb;
  --border-color: #373b41;
  --reply-bg: #282a2e;
  --reply-highlight: #3c3f44;
  --postblock-bg: #373b41;
  --postblock-text: #de935f;
  --name-color: #b5bd68;
  --trip-color: #8abeb7;
  --date-color: #969896;
  --nav-bg: #212326;
  --input-bg: #1d1f21;
  --input-border: #373b41;
  --btn-bg: #373b41;
  --btn-hover: #4b4e54;
}

/* Общие стили ретро-имиджборда эпохи 2000-х */
html {
  height: 100%;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-color, #c5c8c6);
  background-color: var(--bg-color, #1d1f21);
  overflow-x: hidden;
}

body.drawer-active {
  overflow: hidden;
  overscroll-behavior: contain;
}

a {
  color: var(--link-color, #34345c);
  text-decoration: underline;
}

a:hover {
  color: var(--link-hover, #d00);
}

/* Навигация (Navbar) */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 12px;
  background-color: var(--nav-bg, rgba(0, 0, 0, 0.05));
  border-bottom: 1px solid var(--border-color, #cca);
}

.top-navbar {
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

/* Кнопка бургер-меню (скрыта на ПК, видна на мобильных) */
.burger-menu-btn {
  display: none;
  align-items: center;
  gap: 7px;
  background-color: var(--btn-bg, #373b41);
  border: 1px solid var(--border-color, #4b4e54);
  color: var(--text-color, #c5c8c6);
  padding: 4px 9px;
  font-size: 12px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  touch-action: manipulation;
  line-height: 1;
}

.burger-menu-btn:hover,
.burger-menu-btn:active {
  background-color: var(--btn-hover, #4b4e54);
  color: #fff;
  border-color: #81a2be;
}

.burger-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 14px;
  height: 11px;
}

.burger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--text-color, #c5c8c6);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.burger-menu-btn:hover .burger-icon span {
  background-color: #fff;
}

.burger-text {
  font-size: 11px;
}

.nav-mobile-title {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
}

.nav-mobile-brand-link {
  color: var(--title-color, #cc6666);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.nav-mobile-board-tag {
  color: var(--postblock-text, #de935f);
  font-family: monospace;
  font-size: 12px;
}

/* Боковое бургер-меню (Drawer) */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 290px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--reply-bg, #282a2e);
  border-right: 2px solid var(--border-color, #373b41);
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.65);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.side-drawer.is-open {
  transform: translateX(0);
}

.drawer-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top, 10px)) 14px 10px;
  background-color: var(--nav-bg, #212326);
  border-bottom: 1px solid var(--border-color, #373b41);
  flex-shrink: 0;
}

.drawer-brand a {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--title-color, #cc6666);
  text-decoration: none;
}

.drawer-close-btn {
  background: transparent;
  border: 1px solid var(--border-color, #4b4e54);
  color: var(--sub-color, #969896);
  padding: 6px 10px;
  font-size: 13px;
  font-family: monospace;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.drawer-close-btn:hover,
.drawer-close-btn:active {
  color: #fff;
  border-color: #cc6666;
  background-color: rgba(204, 102, 102, 0.15);
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-section-heading {
  font-size: 12px;
  font-weight: bold;
  color: var(--postblock-text, #de935f);
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-color, #373b41);
}

.drawer-user-box {
  background-color: var(--nav-bg, #212326);
  border: 1px solid var(--border-color, #373b41);
  padding: 8px 10px;
  border-radius: 3px;
}

.drawer-user-title {
  font-size: 12px;
  margin-bottom: 6px;
  word-break: break-all;
}

.drawer-username-link {
  color: var(--link-color, #81a2be);
}

.drawer-subnav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-subnav-list li a {
  display: block;
  padding: 5px 8px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text-color, #c5c8c6);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 2px;
}

.drawer-subnav-list li a:hover {
  background-color: var(--btn-hover, #4b4e54);
  border-color: var(--border-color, #4b4e54);
  color: #fff;
}

.drawer-logout-item {
  color: #cc6666 !important;
}

.drawer-guest-box {
  background-color: var(--nav-bg, #212326);
  border: 1px solid var(--border-color, #373b41);
  padding: 10px;
  border-radius: 3px;
}

.drawer-guest-title {
  font-size: 12px;
  font-weight: bold;
  color: var(--postblock-text, #de935f);
  margin-bottom: 8px;
}

.drawer-guest-buttons {
  display: flex;
  gap: 8px;
}

.drawer-guest-buttons a {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  background-color: var(--btn-bg, #373b41);
  color: var(--text-color, #c5c8c6);
  border: 1px solid var(--border-color, #4b4e54);
  border-radius: 3px;
}

.drawer-guest-buttons a:hover {
  background-color: var(--btn-hover, #4b4e54);
  color: #fff;
}

.drawer-guest-buttons .drawer-reg-btn {
  color: #85c292;
  border-color: #3f6e46;
}

.drawer-nav-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text-color, #c5c8c6);
  border-radius: 2px;
  transition: background-color 0.15s ease;
}

.drawer-nav-item:hover {
  background-color: var(--btn-hover, #4b4e54);
  color: #fff;
}

.drawer-board-link.active-board-link {
  background-color: rgba(204, 102, 102, 0.15);
  border-left: 3px solid var(--title-color, #cc6666);
  color: #fff;
}

.drawer-footer {
  padding: 8px 14px max(8px, env(safe-area-inset-bottom, 8px));
  font-size: 10px;
  color: var(--sub-color, #969896);
  border-top: 1px solid var(--border-color, #373b41);
  background-color: var(--nav-bg, #212326);
  text-align: center;
  flex-shrink: 0;
}

.nav-boards a {
  text-decoration: none;
  font-weight: bold;
  padding: 0 2px;
}

.nav-boards a:hover {
  text-decoration: underline;
}

.nav-controls select {
  font-size: 11px;
  padding: 1px 3px;
}

/* Контейнер */
.container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 15px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Шапка сайта и досок */
.header-box, .board-header {
  text-align: center;
  margin: 15px 0 10px;
}

.logo-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--title-color, #800000);
}

.logo-sub {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--sub-color, #555);
}

.board-title {
  margin: 0 0 4px;
  font-size: 22px;
  color: var(--title-color, #800000);
}

.board-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
  font-style: italic;
  color: var(--sub-color, #555);
}

.board-nav-actions {
  font-size: 12px;
  margin-top: 4px;
}

.retro-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--border-color, #999);
  background-color: var(--reply-bg, #f0e0d6);
  border-radius: 3px;
}

hr {
  border: none;
  border-top: 1px solid var(--border-color, #cca);
  margin: 14px 0;
}

/* Главная страница */
.welcome-box {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.welcome-box h2 {
  margin-top: 0;
  font-size: 16px;
  color: var(--title-color, #800000);
}

.rules-box {
  margin-top: 10px;
  padding: 8px 12px;
  background-color: var(--bg-color, #fff);
  border: 1px dashed var(--border-color, #aaa);
}

.rules-box ol {
  margin: 6px 0 0 20px;
  padding: 0;
}

.home-grid {
  display: flex;
  gap: 20px;
}

.boards-column {
  flex: 2;
}

.sidebar-column {
  flex: 1;
}

.board-card {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.board-card-locked {
  border-left: 3px solid #de935f;
}

.board-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.board-desc {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--sub-color, #444);
}

.board-actions {
  font-size: 11px;
}

.stats-box, .recent-box {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 10px 12px;
  margin-bottom: 15px;
}

.stats-box h3, .recent-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color, #d9bfb7);
  padding-bottom: 4px;
  color: var(--title-color, #800000);
}

.stats-box p {
  margin: 4px 0;
  font-size: 12px;
}

.recent-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
}

.recent-post-item {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--border-color, #ccc);
}

/* Форма постинга */
.post-form-container {
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-toggle-link {
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: bold;
}

.post-table {
  border-spacing: 1px;
  background-color: transparent;
}

.postblock {
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  font-weight: bold;
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid var(--border-color, #d9bfb7);
  text-align: right;
  vertical-align: middle;
}

.post-table input[type="text"],
.post-table input[type="password"],
.post-table textarea {
  font-family: Arial, Tahoma, sans-serif;
  font-size: 12px;
  border: 1px solid #aaa;
  padding: 2px 4px;
  background-color: #fff;
  color: #000;
}

.submit-btn {
  font-size: 12px;
  font-weight: bold;
  margin-left: 6px;
  padding: 2px 8px;
  cursor: pointer;
}

.file-note {
  font-size: 11px;
  color: #666;
  margin-left: 4px;
}

.locked-box {
  background-color: #fdd;
  border: 1px solid #c00;
  color: #900;
  padding: 8px 12px;
  text-align: center;
  font-weight: bold;
  max-width: 500px;
  margin: 10px auto;
}

/* Треды и посты */
.threads-container {
  margin-top: 15px;
}

.thread {
  margin-bottom: 20px;
  clear: both;
}

.thread-divider {
  clear: both;
  border-top: 1px solid var(--border-color, #cca);
  margin: 25px 0;
}

.op-post {
  display: block;
  overflow: hidden;
  margin-bottom: 8px;
}

.post-header {
  font-size: 12px;
  margin-bottom: 4px;
}

.post-subject {
  font-weight: bold;
  color: var(--title-color, #800000);
  margin-right: 4px;
  font-size: 13px;
}

.poster-name {
  font-weight: bold;
  color: var(--name-color, #117743);
  margin-right: 2px;
}

.poster-trip {
  color: var(--trip-color, #228854);
  margin-right: 4px;
}

.post-date {
  color: var(--date-color, #333);
  margin-right: 4px;
}

.post-number a {
  text-decoration: none;
  color: inherit;
}

.post-number a:hover {
  color: #d00;
  text-decoration: underline;
}

.pinned-badge {
  color: #b00;
  font-weight: bold;
  margin-left: 4px;
}

.locked-badge {
  color: #666;
  font-weight: bold;
  margin-left: 4px;
}

.reply-link {
  margin-left: 6px;
  font-size: 12px;
}

/* Файлы и картинки */
.file-info {
  font-size: 11px;
  color: var(--sub-color, #555);
  margin-bottom: 4px;
}

.file-orig-name {
  font-weight: bold;
}

.file-meta {
  color: #666;
}

.thumb-img {
  float: left;
  margin: 2px 20px 8px 0;
  border: 1px solid var(--border-color, #d9bfb7);
  background-color: #fff;
  padding: 2px;
  max-width: 250px;
  max-height: 250px;
  cursor: pointer;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
  transition: opacity 0.15s ease-in-out;
}

.thumb-img:hover {
  opacity: 0.85;
}

.thumb-img.expanded {
  max-width: 95%;
  max-height: none;
  float: none;
  display: block;
  margin: 6px 0;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.file-preview-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 8px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px dashed var(--border-color, #d9bfb7);
  font-size: 11px;
}

.file-preview-thumb {
  max-width: 60px;
  max-height: 60px;
  object-fit: cover;
  border: 1px solid #888;
  background: #fff;
}

.file-preview-name {
  color: var(--sub-color, #444);
  font-weight: bold;
}

.file-clear-btn {
  background: none;
  border: none;
  color: #a00;
  font-weight: bold;
  cursor: pointer;
  font-size: 11px;
}

.file-clear-btn:hover {
  text-decoration: underline;
}

/* Комментарии */
.post-comment {
  margin: 6px 0 6px 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Гринтекст */
.unkfunc {
  color: #789922 !important;
}

/* Спойлеры */
.spoiler {
  background-color: #000;
  color: #000;
  padding: 0 2px;
}

.spoiler:hover {
  color: #fff;
}

/* Ответы (Replies) */
.replies-list {
  margin-left: 10px;
}

.reply-table {
  border-spacing: 0;
  margin: 4px 0;
}

.doubledash {
  vertical-align: top;
  padding: 6px 4px 0 0;
  color: #888;
  font-family: monospace;
  font-weight: bold;
}

.reply {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 6px 10px;
  display: inline-block;
  min-width: 320px;
  max-width: 95%;
}

.reply.highlighted {
  border: 2px solid #d00 !important;
  background-color: var(--reply-highlight, #f8e8d8) !important;
}

.omitted-posts {
  color: var(--sub-color, #707070);
  font-style: italic;
  font-size: 12px;
  margin: 8px 0 8px 15px;
}

/* Панель удаления внизу */
.bottom-delete-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 6px 12px;
  margin: 15px 0;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.delete-controls, .admin-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-btn {
  background-color: #800;
  color: #fff;
  border: 1px solid #500;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.admin-btn:hover {
  background-color: #a00;
}

/* Пагинация */
.pagination {
  text-align: center;
  margin: 20px 0;
  font-size: 13px;
}

/* Каталог */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.catalog-tile {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  overflow: hidden;
  height: 250px;
  display: flex;
  flex-direction: column;
}

.catalog-thumb-link {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.catalog-thumb {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.catalog-counts {
  font-weight: bold;
  color: var(--sub-color, #555);
}

.catalog-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.catalog-text p {
  margin: 3px 0 0;
  color: #333;
}

/* Всплывающее превью цитат */
.quote-preview-popup {
  position: absolute;
  z-index: 1000;
  max-width: 500px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 2px solid var(--border-color, #800000);
  padding: 8px 10px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Плавающий Quick Reply */
.quick-reply-box {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 320px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 2px solid var(--border-color, #800000);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.4);
  z-index: 999;
  font-size: 12px;
}

.qr-header {
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  padding: 4px 8px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
}

.qr-close {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  color: inherit;
}

.qr-row {
  padding: 4px 8px;
}

.qr-row input[type="text"],
.qr-row textarea {
  width: 100%;
  padding: 2px 4px;
  font-size: 12px;
  border: 1px solid #999;
}

.submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Футер */
.site-footer {
  text-align: center;
  margin-top: auto;
  padding: 24px 15px 18px;
  font-size: 11px;
  color: var(--sub-color, #777);
  flex-shrink: 0;
  border-top: 1px solid var(--border-color, #373b41);
}

.site-footer p {
  margin: 4px 0;
}

/* ==========================================
   Стили формы ответа в стиле 4PDA / Форумов
   ========================================== */
.forum-reply-card {
  max-width: 900px;
  margin: 25px auto 15px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.forum-reply-header {
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #d9bfb7);
}

.fr-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fr-icon {
  font-size: 16px;
}

.fr-title {
  font-weight: bold;
  font-size: 14px;
}

.fr-badge {
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.fr-hint {
  font-size: 11px;
  opacity: 0.85;
}

.forum-post-form {
  padding: 12px 16px;
}

.forum-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.ff-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ff-full {
  grid-column: 1 / -1;
}

.ff-group label {
  font-size: 11px;
  font-weight: bold;
  color: var(--sub-color, #555);
}

.ff-group input[type="text"],
.ff-group input[type="password"] {
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid #aaa;
  background-color: #fff;
  border-radius: 2px;
}

/* Тулбар BB-кодов в стиле 4PDA */
.forum-bb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background-color: var(--nav-bg, #eed);
  border: 1px solid var(--border-color, #d9bfb7);
  border-bottom: none;
  padding: 4px 6px;
}

.bb-btn {
  background-color: #fff;
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: #333;
  transition: all 0.1s ease;
}

.bb-btn:hover {
  background-color: #e5e5e5;
  border-color: #888;
}

.bb-btn:active {
  background-color: #ddd;
}

.bb-sep {
  color: #aaa;
  margin: 0 2px;
  font-size: 11px;
}

.bb-clear {
  margin-left: auto;
  color: #800;
  border-color: #d99;
}

.bb-clear:hover {
  background-color: #fee;
}

/* Текстовая область */
.forum-textarea-wrap textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--border-color, #d9bfb7);
  background-color: #fff;
  resize: vertical;
  min-height: 130px;
  box-sizing: border-box;
}

.forum-textarea-wrap textarea:focus {
  outline: none;
  border-color: #6699cc;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Дропзона и прикрепление картинок */
.forum-attachment-bar {
  margin-top: 8px;
}

.attach-dropzone {
  border: 1px dashed var(--border-color, #888);
  background-color: rgba(255, 255, 255, 0.6);
  padding: 8px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.attach-dropzone:hover, .attach-dropzone.dragover {
  background-color: #fff;
  border-color: #0066cc;
  box-shadow: 0 0 5px rgba(0, 102, 204, 0.3);
}

.file-hidden-input {
  display: none;
}

.attach-icon {
  font-size: 16px;
}

.file-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 6px 10px;
  background-color: #fff;
  border: 1px solid var(--border-color, #d9bfb7);
}

.file-preview-thumb {
  max-width: 60px;
  max-height: 60px;
  object-fit: cover;
  border: 1px solid #aaa;
}

.file-preview-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}

.file-preview-name {
  font-weight: bold;
}

.file-clear-btn {
  background: none;
  border: none;
  color: #cc0000;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.file-clear-btn:hover {
  text-decoration: underline;
}

/* Нижняя панель с кнопкой отправки */
.forum-submit-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.forum-submit-btn {
  background-color: #1a62b8;
  color: #ffffff;
  border: 1px solid #104687;
  padding: 8px 24px;
  font-size: 13px;
  font-weight: bold;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.15s ease;
}

.forum-submit-btn:hover {
  background-color: #2475d4;
  border-color: #1656a4;
  transform: translateY(-1px);
}

.forum-submit-btn:active {
  transform: translateY(0);
}

.forum-reset-btn {
  background-color: transparent;
  color: var(--sub-color, #666);
  border: 1px solid transparent;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
}

.forum-reset-btn:hover {
  color: #000;
  text-decoration: underline;
}

/* Кнопка [Цитата] в постах */
.post-quote-inline-btn {
  background: none;
  border: none;
  color: var(--link-color, #34345c);
  font-size: 11px;
  cursor: pointer;
  padding: 0 4px;
  font-weight: bold;
}

.post-quote-inline-btn:hover {
  color: #d00;
  text-decoration: underline;
}

.action-highlight {
  font-weight: bold;
  color: #0066cc !important;
}

/* Оформление BB-цитат и блоков кода */
.forum-quote {
  margin: 8px 0;
  padding: 6px 12px;
  background-color: rgba(0, 0, 0, 0.03);
  border-left: 3px solid var(--title-color, #800000);
  font-style: italic;
}

.code-block {
  background-color: #222;
  color: #a6e22e;
  padding: 8px 12px;
  border-radius: 3px;
  overflow-x: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  margin: 6px 0;
}

/* ========================================================
   Стили общих школьных чатов ранних 2000-х (без эмодзи)
   ======================================================== */
.chat-stream-container {
  margin: 10px 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message-row {
  margin: 0;
}

.chat-meta-bar {
  font-size: 11px;
  color: var(--sub-color, #555);
  margin-top: 4px;
}

/* ==========================================
   ОБЛЕГЧЕННАЯ ПАНЕЛЬ ВВОДА В СТИЛЕ 4CHAN
   ========================================== */
.post-form-outer {
  max-width: 580px;
  margin: 12px auto 16px;
  text-align: center;
}

.post-form-toggle-wrap {
  font-family: Arial, Tahoma, sans-serif;
  font-size: 14px;
  font-weight: bold;
  margin: 6px 0;
}

.post-form-toggle-btn {
  color: var(--link-color, #0000ee);
  text-decoration: underline;
  cursor: pointer;
  display: inline-block;
  padding: 2px 6px;
}

.post-form-toggle-btn:hover {
  color: var(--link-hover, #ff0000);
}

.chat-form-collapsible {
  margin-top: 8px;
  text-align: left;
}

.compact-post-form {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.compact-label {
  font-size: 12px;
  font-weight: bold;
  color: var(--title-color, #800000);
  min-width: 45px;
}

.compact-input {
  flex: 1;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border-color, #aaa);
  background: #fff;
  color: #000;
}

.compact-textarea {
  width: 100%;
  padding: 6px 8px;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid var(--border-color, #aaa);
  background: #fff;
  color: #000;
  box-sizing: border-box;
  resize: vertical;
  min-height: 80px;
}

.compact-textarea:focus,
.compact-input:focus {
  outline: 1px solid #6699cc;
}

.compact-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-file-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.compact-file-label {
  background-color: #e5e5e5;
  border: 1px solid #888;
  padding: 3px 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
}

.compact-file-label:hover {
  background-color: #fff;
}

.compact-file-name {
  color: var(--sub-color, #666);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-clear-btn {
  background: none;
  border: none;
  color: #c00;
  cursor: pointer;
  font-weight: bold;
  padding: 0 2px;
  font-size: 12px;
}

.compact-submit-wrap {
  margin-left: auto;
}

.compact-submit-btn {
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  border: 1px solid #999;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.compact-submit-btn:hover {
  background-color: #ffd8a8;
}

.thread-bottom-nav {
  text-align: center;
  margin: 16px 0 24px;
  font-size: 13px;
  font-family: Arial, Tahoma, sans-serif;
}

/* Стили заголовков тредов и кнопок удаления */
.thread-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.thread-subject-title {
  font-weight: bold;
  color: var(--title-color, #800000);
  font-size: 13px;
}

.thread-actions-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-delete-btn {
  background: none;
  border: none;
  color: #b00;
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

.thread-delete-btn:hover {
  text-decoration: underline;
  color: #d00;
}

.chat-subject-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.chat-subject-row label {
  font-weight: bold;
}

.chat-subject-row input[type="text"] {
  flex: 1;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid #aaa;
  background: #fff;
}

/* ==========================================
   Стили аутентификации и бейджей пользователей
   ========================================== */
.nav-auth-user {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-badge {
  background-color: #800000;
  color: #ffffff;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #500000;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
}

.field-warn {
  color: #b00;
  font-size: 11px;
  margin-left: 6px;
  font-weight: normal;
}

.auth-card {
  max-width: 460px;
  margin: 35px auto;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-header {
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  padding: 6px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color, #d9bfb7);
}

.auth-notice {
  padding: 10px 14px 4px;
  font-size: 12px;
  color: var(--sub-color, #444);
  line-height: 1.4;
}

.tg-bot-notice {
  background-color: #eef7ee;
  border: 1px solid #7da67d;
  padding: 10px 14px;
  margin: 10px 14px 4px;
  color: #1e4d1e;
  font-size: 12px;
  line-height: 1.5;
}

.tg-bot-link {
  color: #1a6b1a;
  text-decoration: underline;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
}

.tg-bot-link:hover {
  color: #0b450b;
}

.auth-error {
  margin: 10px 14px 0;
  padding: 6px 10px;
  background-color: #fee;
  border: 1px solid #c00;
  color: #a00;
  font-size: 12px;
  font-weight: bold;
}

.auth-form {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field label {
  font-weight: bold;
  font-size: 12px;
  color: var(--sub-color, #333);
}

.auth-field input[type="text"],
.auth-field input[type="password"] {
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid #aaa;
  background-color: #fff;
  border-radius: 2px;
}

.auth-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
}

.auth-submit-btn {
  font-size: 12px;
  font-weight: bold;
  padding: 4px 14px;
  cursor: pointer;
  background-color: #f5f5f5;
  border: 1px solid #999;
}

.auth-submit-btn:hover {
  background-color: #e5e5e5;
}

.guest-auth-banner {
  max-width: 900px;
  margin: 25px auto 15px;
  padding: 14px 20px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px dashed var(--border-color, #d9bfb7);
  text-align: center;
  font-size: 13px;
  font-weight: bold;
}

.guest-auth-banner a {
  color: var(--title-color, #800000);
  text-decoration: underline;
}

.guest-auth-banner a:hover {
  color: #d00;
}

.board-locked-banner {
  max-width: 900px;
  margin: 25px auto 15px;
  padding: 14px 20px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px dashed #de935f;
  color: #de935f;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.delete-submit-btn {
  background-color: #800000;
  color: #fff;
  border: 1px solid #500000;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.delete-submit-btn:hover {
  background-color: #a00000;
}

/* ==========================================
   СТИЛИ ЛИДЕРБОРДА И САЙДБАРОВ
   ========================================== */

.home-layout-with-sidebar,
.board-layout-with-sidebar {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex: 1 0 auto;
  width: 100%;
}

.home-left-sidebar {
  flex: 0 0 280px;
  width: 280px;
  max-width: 100%;
}

.board-left-sidebar {
  flex: 0 0 260px;
  width: 260px;
  max-width: 100%;
}

.home-main-content,
.board-main-content {
  flex: 1;
  min-width: 0;
}

.leaderboard-widget {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 10px 12px;
  margin-bottom: 15px;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.06);
}

.leaderboard-widget-header {
  border-bottom: 1px solid var(--border-color, #d9bfb7);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.leaderboard-widget-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--title-color, #800000);
}

.leaderboard-widget-sub {
  font-size: 11px;
  color: var(--sub-color, #666);
  margin-top: 2px;
}

.leaderboard-widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}

.leaderboard-widget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dotted var(--border-color, #ddd);
}

.leaderboard-widget-item:last-child {
  border-bottom: none;
}

.lb-item-user {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-item-rank {
  font-weight: bold;
  min-width: 20px;
  font-size: 13px;
}

.lb-item-name {
  font-weight: bold;
  color: var(--link-color, #0000ee);
  text-decoration: none;
}

.lb-item-name:hover {
  text-decoration: underline;
}

.lb-item-score {
  font-size: 11px;
  white-space: nowrap;
  background: rgba(0,0,0,0.04);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.06);
}

.lb-item-label {
  color: var(--sub-color, #666);
}

.leaderboard-widget-footer {
  margin-top: 8px;
  text-align: right;
  font-size: 11px;
}

.leaderboard-item-empty {
  font-style: italic;
  color: #777;
  padding: 6px 0;
  font-size: 12px;
}

.admin-badge-mini {
  display: inline-block;
  background-color: #800000;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 2px;
  vertical-align: middle;
}

.nav-leaderboard-link {
  font-weight: bold;
  color: var(--title-color, #800000);
}

.poster-name-link,
.post-author-link {
  text-decoration: none;
  color: inherit;
}

.poster-name-link:hover .poster-name,
.post-author-link:hover .post-author {
  text-decoration: underline;
}

/* Полная страница лидерборда */
.leaderboard-page-header {
  text-align: center;
  margin-bottom: 20px;
}

.leaderboard-page-desc {
  font-size: 13px;
  color: var(--sub-color, #555);
  margin-top: 4px;
}

.leaderboard-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 10px 14px;
  margin-bottom: 15px;
  font-size: 12px;
}

.tabs-label {
  font-weight: bold;
  margin-right: 6px;
}

.tab-btn {
  display: inline-block;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--border-color, #aaa);
  color: var(--text-color, #000);
  text-decoration: none;
  font-size: 12px;
  transition: background 0.15s;
}

.tab-btn:hover {
  background: #eef;
}

.tab-btn.active-tab {
  background: var(--title-color, #800000);
  color: #fff;
  border-color: var(--title-color, #800000);
  font-weight: bold;
}

.leaderboard-current-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--title-color, #800000);
  padding-bottom: 4px;
}

.leaderboard-current-info h3 {
  margin: 0;
  font-size: 15px;
}

.leaderboard-current-info h3 span {
  color: var(--title-color, #800000);
}

.leaderboard-total-count {
  font-size: 12px;
}

.leaderboard-table-wrap {
  background-color: #fff;
  border: 1px solid var(--border-color, #d9bfb7);
  margin-bottom: 20px;
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leaderboard-table th {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 8px 12px;
  text-align: left;
  font-weight: bold;
  color: var(--title-color, #800000);
}

.leaderboard-table td {
  border: 1px solid var(--border-color, #e4d5cf);
  padding: 8px 12px;
}

.leaderboard-table tbody tr:hover {
  background-color: rgba(0,0,0,0.03);
}

.lb-row.rank-gold {
  background-color: #fffbe6;
}

.lb-row.rank-silver {
  background-color: #f7f9fa;
}

.lb-row.rank-bronze {
  background-color: #fff8f0;
}

.lb-td-rank {
  text-align: center;
  font-size: 14px;
}

.lb-td-threads,
.lb-td-replies {
  text-align: center;
  font-size: 13px;
}

.lb-td-total {
  text-align: center;
}

.lb-total-badge {
  display: inline-block;
  background: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 2px 10px;
  font-weight: bold;
  font-size: 14px;
  color: var(--title-color, #800000);
}

.table-empty {
  text-align: center;
  padding: 20px;
  color: #777;
  font-style: italic;
}

.leaderboard-info-note {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px dashed var(--border-color, #d9bfb7);
  padding: 12px 16px;
  font-size: 12px;
  margin-top: 15px;
}

/* ==========================================
   СТИЛИ ПРОФИЛЯ ПОЛЬЗОВАТЕЛЯ И ПОДПИСОК
   ========================================== */

.profile-page-container {
  max-width: 960px;
  margin: 15px auto;
}

.profile-header-card {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.08);
}

.profile-top-bar {
  display: flex;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #d9bfb7);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.profile-avatar-retro {
  width: 60px;
  height: 60px;
  background-color: var(--postblock-bg, #ea8);
  color: var(--postblock-text, #800000);
  border: 2px solid var(--border-color, #d9bfb7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 24px;
  font-family: monospace;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.profile-main-info {
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.profile-username {
  margin: 0;
  font-size: 20px;
  color: var(--title-color, #800000);
}

.user-badge {
  background-color: #2e6b38;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 2px;
}

.profile-meta-row {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--sub-color, #555);
  margin-bottom: 8px;
}

.profile-action-row {
  margin-top: 6px;
}

.profile-follow-btn {
  background-color: #2e6b38;
  color: #fff;
  border: 1px solid #1c4a24;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.profile-follow-btn:hover {
  background-color: #3b8747;
}

.profile-unfollow-btn {
  background-color: #666;
  color: #fff;
  border: 1px solid #444;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.profile-unfollow-btn:hover {
  background-color: #888;
}

.profile-self-badge, .profile-guest-note {
  font-size: 12px;
  color: var(--sub-color, #666);
  font-style: italic;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.profile-stat-box {
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 8px 10px;
  text-align: center;
}

.profile-stat-box.highlight-stat {
  background: rgba(128, 0, 0, 0.06);
  border-color: var(--title-color, #800000);
}

.profile-stat-val {
  display: block;
  font-size: 18px;
  font-weight: bold;
  color: var(--title-color, #800000);
}

.profile-stat-lbl {
  font-size: 11px;
  color: var(--sub-color, #666);
}

.profile-posts-section {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 14px 18px;
}

.profile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--title-color, #800000);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.profile-section-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--title-color, #800000);
}

.profile-posts-counter {
  font-size: 12px;
}

.user-post-item {
  background: #fff;
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 8px 12px;
  margin-bottom: 8px;
}

.user-post-header {
  font-size: 12px;
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-post-badge {
  font-size: 11px;
  color: var(--sub-color, #555);
}

.user-post-subject {
  color: var(--link-color, #0000ee);
  text-decoration: none;
}

.user-post-subject:hover {
  text-decoration: underline;
}

.user-post-date {
  color: var(--sub-color, #888);
  font-size: 11px;
  margin-left: auto;
}

.user-post-snippet {
  font-size: 13px;
  color: var(--text-color, #111);
}

.user-post-snippet a {
  color: inherit;
  text-decoration: none;
}

.user-post-snippet a:hover {
  text-decoration: underline;
}

.profile-no-posts {
  padding: 20px;
  text-align: center;
  color: #777;
  font-style: italic;
  font-size: 13px;
}

/* ==========================================
   СТИЛИ ПАНЕЛИ АДМИНИСТРАТОРА (ИНВАЙТ-КОДЫ)
   ========================================== */

.admin-invites-container {
  max-width: 960px;
  margin: 15px auto;
}

.admin-header-box {
  text-align: center;
  margin-bottom: 18px;
}

.admin-header-desc {
  font-size: 13px;
  color: var(--sub-color, #666);
}

.admin-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 12px 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-gen-form {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.admin-select {
  padding: 4px 8px;
  font-size: 12px;
}

.admin-gen-btn {
  background-color: var(--title-color, #800000);
  color: #fff;
  border: 1px solid #4a0000;
  padding: 4px 12px;
  font-weight: bold;
  cursor: pointer;
  font-size: 12px;
}

.admin-gen-btn:hover {
  background-color: #a00000;
}

.admin-export-btn {
  display: inline-block;
  background: #20502a;
  color: #fff;
  border: 1px solid #13341a;
  padding: 5px 12px;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
}

.admin-export-btn:hover {
  background: #2b6a37;
}

.admin-codes-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.code-stat-pill {
  flex: 1;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
}

.code-stat-pill.active {
  border-color: #2e6b38;
}

.code-stat-pill.active b {
  color: #2e6b38;
}

.code-stat-pill.used {
  opacity: 0.8;
}

.invite-code-pill {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1.5px;
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 3px;
}

.code-status.active {
  color: #2e6b38;
  font-weight: bold;
}

.code-status.used {
  color: #888;
  text-decoration: line-through;
}

.auth-success-notice {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.auth-hint {
  display: block;
  font-size: 11px;
  color: var(--sub-color, #777);
  margin-top: 3px;
}

/* Медиа-запрос для экранов меньше 850px */
@media (max-width: 850px) {
  .home-layout-with-sidebar,
  .board-layout-with-sidebar {
    flex-direction: column;
  }
  .home-left-sidebar,
  .board-left-sidebar {
    width: 100%;
    flex: auto;
  }
  .profile-top-bar {
    flex-direction: column;
    text-align: center;
  }
  .profile-meta-row {
    justify-content: center;
  }
}

.profile-change-pw-card {
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #d9bfb7);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.change-pw-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.change-pw-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.change-pw-field input {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color, #999);
}

/* ==========================================
   TENOR GIF В СООБЩЕНИЯХ
   ========================================== */
.tenor-gif-wrap {
  display: block;
  margin: 6px 0;
  max-width: 100%;
  clear: both;
}

.tenor-gif-thumb {
  max-height: 280px;
  max-width: 100%;
  height: auto;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--border-color, #d9bfb7);
  box-sizing: border-box;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.04);
  transition: max-height 0.15s ease-out;
}

.tenor-gif-thumb.expanded {
  max-height: none !important;
  max-width: 100% !important;
}

.tenor-loading {
  font-size: 11px;
  color: #888;
  font-style: italic;
  display: inline-block;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed var(--border-color, #ccc);
}

.tenor-fallback-link {
  font-size: 12px;
  color: var(--link-color, #0000ee);
  text-decoration: underline;
}

#quote-preview .tenor-gif-thumb {
  max-height: 120px;
}

/* ==========================================
   СИСТЕМА БАНОВ И БЛОКИРОВОК (00-е РЕТРО)
   ========================================== */

.badge-banned {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-family: monospace;
  font-weight: bold;
  background-color: #b30000;
  color: #ffffff;
  border: 1px solid #800000;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

.badge-banned-mini {
  display: inline-block;
  font-family: monospace;
  font-weight: bold;
  font-size: 11px;
  color: #ff3333;
  margin-right: 4px;
}

.profile-ban-alert {
  margin: 12px 0;
  padding: 10px 14px;
  background-color: rgba(179, 0, 0, 0.08);
  border: 2px solid #b30000;
  font-size: 12px;
}

.profile-ban-alert-header {
  color: #b30000;
  font-size: 13px;
  margin-bottom: 6px;
}

.profile-ban-alert-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-profile-manage-card {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px dashed var(--border-color, #cca);
  background-color: var(--post-bg, rgba(0, 0, 0, 0.03));
}

.admin-ban-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.admin-ban-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.admin-ban-field input[type="text"] {
  padding: 4px 8px;
  font-size: 12px;
  min-width: 250px;
  border: 1px solid var(--border-color, #999);
}

.admin-ban-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: bold;
  background-color: #b30000;
  color: #ffffff;
  border: 1px solid #800000;
  cursor: pointer;
}

.admin-ban-btn:hover {
  background-color: #d00000;
}

.admin-unban-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: bold;
  background-color: #226622;
  color: #ffffff;
  border: 1px solid #114411;
  cursor: pointer;
}

.admin-unban-btn:hover {
  background-color: #2e882e;
}

.admin-unban-box {
  margin-top: 8px;
  font-size: 13px;
}

/* Бан-лист (/admin/bans) */
.admin-bans-container {
  max-width: 1000px;
  margin: 0 auto;
}

.admin-quick-ban-card {
  margin: 14px 0;
  padding: 12px 16px;
  border: 1px solid var(--border-color, #cca);
  background-color: var(--post-bg, rgba(0, 0, 0, 0.03));
}

.admin-quick-ban-header h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--title-color, #800000);
}

.admin-quick-ban-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.admin-quick-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.admin-quick-field input {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color, #999);
}

.ban-status.active {
  color: #ff3333;
  font-weight: bold;
  font-family: monospace;
}

.ban-status.expired {
  color: #888888;
  font-family: monospace;
}

.admin-table-unban-btn {
  padding: 2px 6px;
  font-size: 11px;
  background-color: transparent;
  color: #2e882e;
  border: 1px solid #2e882e;
  cursor: pointer;
  font-weight: bold;
}

.admin-table-unban-btn:hover {
  background-color: #2e882e;
  color: #ffffff;
}

.row-ban-active {
  background-color: rgba(179, 0, 0, 0.04);
}

.row-ban-expired {
  opacity: 0.75;
}

/* Страница отказа в доступе (Notice) */
.banned-notice-wrapper {
  max-width: 650px;
  margin: 40px auto;
}

.banned-notice-box {
  border: 3px double #b30000;
  background-color: var(--post-bg, rgba(0, 0, 0, 0.04));
  padding: 24px;
  text-align: center;
}

.banned-notice-title {
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: 1px;
  color: #b30000;
}

.banned-notice-body {
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  margin-bottom: 20px;
}

.banned-lead-text {
  font-size: 14px;
  margin-bottom: 14px;
}

.banned-details-grid {
  border: 1px solid var(--border-color, #cca);
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.02);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banned-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.banned-detail-label {
  color: var(--sub-color, #666);
}

.banned-detail-val {
  font-family: monospace;
}

.banned-footer-text {
  font-size: 12px;
  color: var(--sub-color, #666);
  margin: 0;
}

.banned-notice-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
}

.banned-back-btn, .banned-home-btn {
  font-weight: bold;
}

/* ==========================================
   УПРАВЛЕНИЕ АДМИНИСТРАТОРАМИ, БЕЙДЖ 1337 И РАЗДЕЛЫ
   ========================================== */

/* Бейдж 1337 в ретро-стиле ранних 2000-х */
.badge-1337 {
  display: inline-block;
  background-color: #122915;
  color: #39ff14;
  border: 1px solid #238636;
  padding: 1px 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.8px;
  border-radius: 2px;
  text-shadow: 0 0 3px rgba(57, 255, 20, 0.4);
  vertical-align: middle;
}

.badge-1337-mini {
  display: inline-block;
  background-color: #122915;
  color: #39ff14;
  border: 1px solid #238636;
  padding: 0 4px;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  font-weight: bold;
  border-radius: 2px;
  text-shadow: 0 0 2px rgba(57, 255, 20, 0.4);
  vertical-align: middle;
}

.badge-banned-mini {
  display: inline-block;
  background-color: #b30000;
  color: #ffffff;
  padding: 0 4px;
  font-size: 10px;
  font-weight: bold;
  font-family: monospace;
  border-radius: 2px;
  vertical-align: middle;
}

/* Статусы ролей персонала */
.role-superadmin-pill {
  display: inline-block;
  background-color: rgba(179, 0, 0, 0.15);
  color: #c92a2a;
  border: 1px solid #c92a2a;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: bold;
  font-family: monospace;
  border-radius: 2px;
}

.role-admin-pill {
  display: inline-block;
  background-color: rgba(33, 115, 70, 0.15);
  color: #2b8a3e;
  border: 1px solid #2b8a3e;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: bold;
  font-family: monospace;
  border-radius: 2px;
}

.role-user-pill {
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--sub-color, #666);
  border: 1px solid var(--border-color, #ccc);
  padding: 1px 6px;
  font-size: 11px;
  font-family: monospace;
  border-radius: 2px;
}

/* Кнопки действий в таблицах */
.admin-table-action-btn {
  padding: 2px 6px;
  font-size: 11px;
  background-color: transparent;
  color: var(--link-color, #0044cc);
  border: 1px solid var(--border-color, #888);
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
}

.admin-table-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.admin-badge-toggle-btn {
  color: #b07000;
  border-color: #b07000;
}

.admin-badge-toggle-btn:hover {
  background-color: #b07000;
  color: #ffffff;
}

.admin-badge-grant-btn {
  color: #2e882e;
  border-color: #2e882e;
}

.admin-badge-grant-btn:hover {
  background-color: #2e882e;
  color: #ffffff;
}

.badge-locked {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: bold;
  color: #de935f;
  background-color: rgba(222, 147, 95, 0.1);
  border: 1px solid #de935f;
  border-radius: 2px;
  font-family: monospace;
}

.admin-lock-btn {
  color: #de935f;
  border-color: #de935f;
}

.admin-lock-btn:hover {
  background-color: #de935f;
  color: #1d1f21;
}

.admin-unlock-btn {
  color: #85c292;
  border-color: #85c292;
}

.admin-unlock-btn:hover {
  background-color: #85c292;
  color: #1d1f21;
}

.row-board-locked {
  background-color: rgba(222, 147, 95, 0.03);
}

.staff-actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.table-muted-text {
  color: var(--sub-color, #888);
  font-style: italic;
  font-size: 11px;
}

/* Разделы (/admin/boards) */
.board-table-id-link {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  color: var(--title-color, #800000);
}

.board-create-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.admin-board-create-form {
  display: flex;
  flex-direction: column;
}

.admin-board-edit-details {
  display: inline-block;
  margin-right: 4px;
}

.admin-board-edit-details > summary {
  list-style: none;
  cursor: pointer;
}

.admin-board-edit-details > summary::-webkit-details-marker {
  display: none;
}

.admin-board-inline-form-box {
  margin-top: 8px;
  padding: 10px;
  background-color: var(--reply-bg, #f0e0d6);
  border: 1px solid var(--border-color, #cca);
  text-align: left;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}

.admin-inline-board-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  font-size: 12px;
}

.admin-inline-board-form .inline-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-inline-board-form label {
  font-size: 11px;
  color: var(--sub-color, #555);
}

.admin-inline-board-form input[type="text"],
.admin-inline-board-form input[type="number"] {
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border-color, #999);
}

/* ==========================================
   Аватарки (1x1) и Блок 1337-администраторов
   ========================================== */

/* Блок 1337-администраторов в левом сайдбаре (стиль лидерборда) */
.admins-1337-box {
  background-color: var(--reply-bg, #282a2e);
  border: 1px solid var(--border-color, #373b41);
  padding: 10px 12px;
  margin-bottom: 15px;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.admins-1337-box .leaderboard-widget-header,
.admins-1337-header {
  border-bottom: 1px solid var(--border-color, #373b41);
  padding-bottom: 5px;
  margin-bottom: 8px;
  background: transparent;
}

.admins-1337-box .leaderboard-widget-header h3,
.admins-1337-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--title-color, #cc6666);
}

.admins-1337-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}

.admin-1337-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dotted var(--border-color, #373b41);
}

.admin-1337-item:last-child {
  border-bottom: none;
}

.admin-1337-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.admin-1337-avatar {
  width: 32px;
  height: 32px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--border-color, #373b41);
  border-radius: 2px;
  flex-shrink: 0;
  background-color: #1d1f21;
}

.admin-1337-avatar-placeholder {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--postblock-bg, #373b41);
  color: var(--postblock-text, #de935f);
  font-weight: bold;
  font-size: 12px;
  border: 1px solid var(--border-color, #373b41);
  border-radius: 2px;
  flex-shrink: 0;
}

.admin-1337-name {
  color: var(--link-color, #81a2be);
  text-decoration: none;
  font-size: 13px;
  word-break: break-word;
}

.admin-1337-name:hover {
  text-decoration: underline;
  color: var(--link-hover, #b294bb);
}

.badge-1337-mini {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: bold;
  background: linear-gradient(135deg, #111, #222);
  color: #00ff66;
  border: 1px solid #00aa44;
  border-radius: 2px;
  font-family: monospace;
  box-shadow: 0 0 3px rgba(0, 255, 102, 0.25);
  flex-shrink: 0;
}

.admin-1337-empty {
  padding: 10px 0;
  margin: 0;
  font-size: 12px;
  color: var(--sub-color, #969896);
  font-style: italic;
  text-align: center;
}

/* Аватарки в постах и ответах (1x1, 40x40) */
.post-user-avatar {
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--border-color, #373b41);
  border-radius: 2px;
  vertical-align: middle;
  display: inline-block;
  margin-right: 6px;
  background-color: #1d1f21;
}

.post-user-avatar-placeholder {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--postblock-bg, #373b41);
  color: var(--postblock-text, #de935f);
  font-weight: bold;
  font-size: 14px;
  border: 1px solid var(--border-color, #373b41);
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 6px;
}

/* Аватарка в профиле пользователя (1x1, 80x80) */
.profile-avatar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 80px;
  height: 80px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 2px solid var(--border-color, #373b41);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  background-color: #1d1f21;
}

.profile-avatar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.profile-avatar-btn {
  background: none;
  border: none;
  color: var(--link-color, #81a2be);
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 4px;
  text-decoration: underline;
}

.profile-avatar-btn:hover {
  color: var(--link-hover, #b294bb);
}

.profile-avatar-btn.btn-avatar-del {
  color: #cc6666;
}

.profile-avatar-btn.btn-avatar-del:hover {
  color: #e06c75;
}

/* Модальное окно обрезки 1:1 */
.avatar-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.avatar-modal-box {
  background-color: var(--reply-bg, #282a2e);
  border: 2px solid var(--border-color, #373b41);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  color: var(--text-color, #c5c8c6);
}

.avatar-modal-header {
  background-color: var(--nav-bg, #212326);
  color: var(--title-color, #cc6666);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #373b41);
}

.avatar-modal-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--title-color, #cc6666);
}

.modal-close-x {
  background: none;
  border: none;
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  color: var(--postblock-text, #de935f);
}

.modal-close-x:hover {
  color: var(--title-color, #cc6666);
}

.avatar-modal-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avatar-modal-hint {
  font-size: 12px;
  color: var(--sub-color, #969896);
  margin: 0;
}

.crop-viewport-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
  border: 2px solid var(--border-color, #373b41);
  background-color: #111;
  overflow: hidden;
  cursor: grab;
}

.crop-viewport-wrapper:active {
  cursor: grabbing;
}

#crop-canvas {
  width: 300px;
  height: 300px;
  display: block;
}

.crop-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  box-sizing: border-box;
  background:
    linear-gradient(to right, transparent 33%, rgba(255,255,255,0.2) 33.3%, rgba(255,255,255,0.2) 34%, transparent 34.3%),
    linear-gradient(to right, transparent 66%, rgba(255,255,255,0.2) 66.3%, rgba(255,255,255,0.2) 67%, transparent 67.3%),
    linear-gradient(to bottom, transparent 33%, rgba(255,255,255,0.2) 33.3%, rgba(255,255,255,0.2) 34%, transparent 34.3%),
    linear-gradient(to bottom, transparent 66%, rgba(255,255,255,0.2) 66.3%, rgba(255,255,255,0.2) 67%, transparent 67.3%);
  border: 1px dashed rgba(255, 255, 255, 0.4);
}

.crop-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  justify-content: center;
  margin-top: 6px;
  color: var(--text-color, #c5c8c6);
}

.crop-controls-row input[type="range"] {
  flex: 1;
  max-width: 200px;
}

.crop-preview-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.crop-preview-label {
  font-size: 12px;
  font-weight: bold;
  color: var(--sub-color, #969896);
}

#crop-preview-canvas {
  border: 1px solid var(--border-color, #373b41);
  width: 60px;
  height: 60px;
  background-color: #1d1f21;
}

.avatar-modal-footer {
  padding: 10px 14px;
  background-color: var(--nav-bg, #212326);
  border-top: 1px solid var(--border-color, #373b41);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================
   ПРАВИЛА RETRO DARK ДЛЯ ВСЕХ ЭЛЕМЕНТОВ
   ========================================== */

/* Поля ввода и текстовые области */
input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  background-color: var(--input-bg, #1d1f21) !important;
  color: var(--text-color, #c5c8c6) !important;
  border: 1px solid var(--border-color, #373b41) !important;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--link-color, #81a2be) !important;
  outline: none;
}

/* Кнопки */
button,
input[type="submit"],
.submit-btn,
.auth-submit-btn,
.bb-btn,
.tool-btn,
.chat-submit-btn,
.compact-submit-btn,
.compact-file-label,
.attach-label-btn,
.admin-gen-btn,
.admin-table-action-btn,
.tab-btn {
  background-color: var(--btn-bg, #373b41) !important;
  color: var(--text-color, #c5c8c6) !important;
  border: 1px solid #4b4e54 !important;
}

button:hover,
input[type="submit"]:hover,
.submit-btn:hover,
.auth-submit-btn:hover,
.bb-btn:hover,
.tool-btn:hover,
.chat-submit-btn:hover,
.compact-submit-btn:hover,
.compact-file-label:hover,
.attach-label-btn:hover,
.admin-gen-btn:hover,
.admin-table-action-btn:hover,
.tab-btn:hover {
  background-color: var(--btn-hover, #4b4e54) !important;
}

/* Карточки, боксы и контейнеры */
.welcome-box,
.board-card,
.stats-box,
.recent-box,
.catalog-tile,
.rules-box,
.forum-reply-card,
.chat-form-card,
.compact-post-form,
.auth-card,
.profile-header-card,
.profile-posts-section,
.profile-change-pw-card,
.admin-actions-bar,
.admin-profile-manage-card,
.admin-quick-ban-card,
.admin-board-inline-form-box,
.guest-auth-banner,
.file-preview-wrap,
.leaderboard-widget,
.leaderboard-tabs-bar,
.leaderboard-info-note,
.leaderboard-table-wrap {
  background-color: var(--reply-bg, #282a2e) !important;
  border-color: var(--border-color, #373b41) !important;
  color: var(--text-color, #c5c8c6) !important;
}

/* Шапки блоков и тулбары */
.forum-bb-toolbar,
.chat-toolbar,
.auth-header,
.leaderboard-table th {
  background-color: var(--nav-bg, #212326) !important;
  border-color: var(--border-color, #373b41) !important;
  color: var(--postblock-text, #de935f) !important;
}

/* Всплывающее превью цитат */
.quote-preview-popup {
  background-color: var(--reply-bg, #282a2e) !important;
  border: 1px solid var(--border-color, #373b41) !important;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6) !important;
  color: var(--text-color, #c5c8c6) !important;
}

/* Таблицы */
.leaderboard-table td,
.admin-table td,
.admin-table th {
  border-color: var(--border-color, #373b41) !important;
}

.leaderboard-table th,
.admin-table th {
  background-color: var(--nav-bg, #212326) !important;
  color: var(--postblock-text, #de935f) !important;
}

.leaderboard-table tbody tr:hover,
.admin-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Рейтинг в лидерборде */
.lb-row.rank-gold {
  background-color: #32301f !important;
}

.lb-row.rank-silver {
  background-color: #2b2e33 !important;
}

.lb-row.rank-bronze {
  background-color: #33271f !important;
}

.lb-total-badge,
.lb-item-score {
  background-color: var(--bg-color, #1d1f21) !important;
  color: var(--postblock-text, #de935f) !important;
  border-color: var(--border-color, #373b41) !important;
}

.tab-btn.active-tab {
  background-color: var(--title-color, #cc6666) !important;
  color: #1d1f21 !important;
  border-color: var(--title-color, #cc6666) !important;
}

/* Дропзона файлов */
.attach-dropzone {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: #4b4e54 !important;
  color: var(--text-color, #c5c8c6) !important;
}

.attach-dropzone:hover,
.attach-dropzone.dragover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--link-color, #81a2be) !important;
}

/* Ошибки и уведомления */
.auth-error {
  background-color: #3c1e1e !important;
  border-color: var(--title-color, #cc6666) !important;
  color: #f08080 !important;
}

.auth-success-notice {
  background-color: #1e3c23 !important;
  border-color: #50a060 !important;
  color: #98fb98 !important;
}

.tg-bot-notice {
  background-color: #1a291e !important;
  border-color: #3f6e46 !important;
  color: var(--text-color, #c5c8c6) !important;
}

.tg-bot-link {
  color: #85c292 !important;
}

.tg-bot-link:hover {
  color: #b5bd68 !important;
}

/* Профили */
.profile-stat-box {
  background: var(--nav-bg, #212326) !important;
  border-color: var(--border-color, #373b41) !important;
}

.profile-stat-box.highlight-stat {
  background: rgba(204, 102, 102, 0.1) !important;
  border-color: var(--title-color, #cc6666) !important;
}

.profile-stat-val {
  color: var(--postblock-text, #de935f) !important;
}

.user-post-item {
  background-color: var(--nav-bg, #212326) !important;
  border-color: var(--border-color, #373b41) !important;
}

.user-post-snippet {
  color: var(--text-color, #c5c8c6) !important;
}

/* Инвайты */
.invite-code-pill {
  background-color: var(--bg-color, #1d1f21) !important;
  color: var(--postblock-text, #de935f) !important;
  border-color: var(--border-color, #373b41) !important;
}

.code-stat-pill {
  background-color: var(--reply-bg, #282a2e) !important;
  border-color: var(--border-color, #373b41) !important;
}

/* Tenor GIF */
.tenor-gif-thumb {
  border-color: var(--border-color, #373b41) !important;
  background-color: var(--bg-color, #1d1f21) !important;
}

.tenor-loading {
  color: var(--sub-color, #969896) !important;
  background: var(--bg-color, #1d1f21) !important;
  border-color: var(--border-color, #373b41) !important;
}

/* ==========================================
   СОГЛАШЕНИЕ С ПРАВИЛАМИ ПЛАТФОРМЫ
   ========================================== */
.auth-card.register-card {
  max-width: 640px;
}

.reg-rules-container {
  padding: 12px 14px;
  background-color: var(--nav-bg, #212326);
  border-bottom: 1px solid var(--border-color, #373b41);
}

.reg-rules-header {
  font-size: 13px;
  font-weight: bold;
  color: var(--postblock-text, #de935f);
  margin-bottom: 6px;
}

.reg-rules-desc {
  font-size: 12px;
  color: var(--sub-color, #969896);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.reg-rules-scrollable {
  max-height: 230px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--bg-color, #1d1f21);
  border: 1px solid var(--border-color, #373b41);
  padding: 10px 12px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.5;
}

.rules-section-group {
  margin-bottom: 12px;
}

.rules-section-group:last-child {
  margin-bottom: 0;
}

.rules-section-title {
  color: var(--title-color, #cc6666);
  font-size: 12px;
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px dotted var(--border-color, #373b41);
}

.rules-item-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: baseline;
}

.rules-item-num {
  color: var(--postblock-text, #de935f);
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}

.rules-item-text {
  color: var(--text-color, #c5c8c6);
}

.rules-consent-field {
  background-color: rgba(63, 110, 70, 0.15);
  border: 1px solid #3f6e46;
  border-radius: 3px;
  padding: 10px 12px;
  margin: 0 0 4px 0 !important;
}

.rules-consent-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.rules-consent-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #85c292;
  flex-shrink: 0;
}

.rules-consent-text {
  color: #85c292;
}

/* ==========================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ (<= 768px)
   ========================================== */
@media (max-width: 768px) {
  /* Предотвращение горизонтального скролла и переполнений */
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  .container {
    padding: 8px 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .navbar,
  .top-navbar {
    position: relative;
    padding: 6px 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .top-navbar .nav-boards,
  .top-navbar .nav-auth-user {
    display: none !important;
  }

  .burger-menu-btn {
    display: inline-flex;
    flex-shrink: 0;
  }

  /* Центрирование мобильного заголовка в навбаре */
  .nav-mobile-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 130px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Центрирование шапки (.header-box, .board-header) */
  .header-box,
  .board-header {
    text-align: center;
    margin: 12px auto 10px;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .logo-title,
  .board-title,
  .board-subtitle,
  .chat-meta-bar {
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Чистое центрирование кнопок действий раздела */
  .board-nav-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 4px 6px;
    line-height: 1.8;
    margin: 6px auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .board-nav-actions a {
    display: inline-block;
    white-space: nowrap;
  }

  /* Симметричное центрирование сайдбаров и карточек главной страницы */
  .home-layout-with-sidebar,
  .board-layout-with-sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    gap: 16px;
    box-sizing: border-box;
  }

  .home-left-sidebar,
  .board-left-sidebar,
  .home-main-content,
  .board-main-content {
    width: 100%;
    max-width: 100%;
    flex: auto;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  .welcome-box,
  .rules-box,
  .leaderboard-box,
  .leaderboard-widget,
  .admins-1337-box,
  .stats-box,
  .recent-box,
  .board-card,
  .boards-section {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin: 12px auto;
    box-sizing: border-box;
  }

  .catalog-tile {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  /* Центрирование контейнеров форм */
  .post-form-container,
  .compact-post-form,
  .post-form-outer,
  .auth-card,
  .form-container,
  .post-table {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .auth-card {
    margin: 15px auto;
  }

  .reg-rules-scrollable {
    max-height: 190px;
  }

  /* ВАЖНО: сохранение выравнивания текста по левому краю для постов, тредов, ответов и цитат */
  .post-body,
  .post-message,
  .post-comment,
  .reply,
  .thread,
  .quote,
  .quote-preview-popup,
  .op-post,
  .replies-list,
  .post-header,
  blockquote {
    text-align: left !important;
  }

  /* Адаптация постов и ответов без горизонтального переполнения */
  .reply {
    min-width: 0 !important;
    max-width: 100% !important;
    width: calc(100% - 20px) !important;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .reply-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    box-sizing: border-box;
  }

  .doubledash {
    width: 20px;
    padding: 6px 2px 0 0;
    vertical-align: top;
  }

  .replies-list {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .thread {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .op-post {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Предотвращение переполнений таблицами, инпутами и медиа */
  table,
  .leaderboard-table-wrap,
  .leaderboard-table {
    max-width: 100%;
    box-sizing: border-box;
  }

  input,
  textarea,
  select,
  button {
    max-width: 100%;
    box-sizing: border-box;
  }

  img,
  video,
  iframe,
  canvas {
    max-width: 100%;
    box-sizing: border-box;
  }

  .thumb-img {
    max-width: 100%;
    height: auto;
  }

  .thumb-img.expanded {
    max-width: 100% !important;
    max-height: none !important;
    float: none;
    display: block;
    margin: 8px 0;
  }

  .file-info {
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .quick-reply-box {
    width: auto;
    max-width: calc(100% - 20px);
    left: 10px;
    right: 10px;
  }

  .crop-viewport-wrapper,
  #crop-canvas {
    max-width: 100%;
  }

  .bottom-delete-bar {
    justify-content: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }
}



