:root {
  --bg: #151716;
  --header: #1b1d1c;
  --block: #212423;
  --block-hover: #262a28;
  --border: #2d3230;
  --text: #e6eae8;
  --muted: #8a928e;
  --faint: #5f6763;
  --danger: #ff6b6b;
  /* Тема «Зелёная» (по умолчанию). Остальные темы ниже переопределяют только эти цвета. */
  --accent: #22c565;          /* ссылки, активные вкладки, рамки в фокусе */
  --accent-strong: #17a354;   /* кнопки и плашки «Новое» */
  --accent-hover: #22c565;    /* кнопка при наведении */
  --accent-dark: #0c5c2f;     /* иконка нового раздела, роль */
  --accent-soft: rgba(34, 197, 101, .12);
  --on-accent: #fff;          /* текст на кнопках */
  --banner: linear-gradient(100deg, #0b5a2d 0%, #0d6a35 45%, #0a4f28 70%, #0e7038 100%);
  --banner-stripe: linear-gradient(180deg, #16a457, #0e7b40);
  --radius: 3px;
  color-scheme: dark;
}

[data-theme="black"] {
  --bg: #0e0e0e;
  --header: #141414;
  --block: #1a1a1a;
  --block-hover: #222;
  --border: #2a2a2a;
  --accent: #e8e8e8;
  --accent-strong: #2c2c2c;
  --accent-hover: #3a3a3a;
  --accent-dark: #000;
  --accent-soft: rgba(255, 255, 255, .07);
  --on-accent: #fff;
  --banner: linear-gradient(100deg, #000 0%, #151515 45%, #080808 70%, #1d1d1d 100%);
  --banner-stripe: linear-gradient(180deg, #2e2e2e, #141414);
}
[data-theme="yellow"] {
  --accent: #ffd43b;
  --accent-strong: #f2b705;
  --accent-hover: #ffd43b;
  --accent-dark: #7a5a00;
  --accent-soft: rgba(255, 212, 59, .12);
  --on-accent: #1a1400;
  --banner: linear-gradient(100deg, #6b4e00 0%, #8a6600 45%, #5c4300 70%, #946f00 100%);
  --banner-stripe: linear-gradient(180deg, #d9a606, #a37c00);
}
[data-theme="blue"] {
  --accent: #4dabf7;
  --accent-strong: #1c7ed6;
  --accent-hover: #339af0;
  --accent-dark: #0b3d74;
  --accent-soft: rgba(77, 171, 247, .12);
  --on-accent: #fff;
  --banner: linear-gradient(100deg, #0b3a6e 0%, #0d4a8a 45%, #082f5a 70%, #0f5299 100%);
  --banner-stripe: linear-gradient(180deg, #2f8fe6, #1260ab);
}
/* В чёрной теме логотип и плашки делаем белыми, чтобы они не терялись на чёрном */
[data-theme="black"] .logo span { color: #fff; }
[data-theme="black"] .badge { background: #e8e8e8; color: #111; }
[data-theme="black"] .node-icon.new { background: #e8e8e8; color: #111; }
[data-theme="black"] .btn { border-color: #3a3a3a; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1340px; margin: 0 auto; padding: 0 20px; }
svg { display: block; }

/* ---------- Шапка ---------- */

.topbar { background: var(--header); }
.topbar-inner { display: flex; align-items: center; height: 82px; gap: 32px; }
.logo { font-size: 32px; font-weight: 800; font-style: italic; letter-spacing: -1px; color: #fff; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a {
  display: flex; align-items: center; padding: 0 14px; height: 100%;
  font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .2px;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: #fff; font-weight: 600; border-bottom-color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.account a, .account button {
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: inherit; font-size: 13px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.account a:hover, .account button:hover { color: var(--text); text-decoration: none; }
.account .me { color: var(--text); font-weight: 600; }

/* Переключатель темы */
.theme-picker { position: relative; }
.theme-picker .menu { left: auto; right: 0; min-width: 190px; }
.theme-picker .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px;
  background: none; border: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.theme-picker .menu button:hover { background: var(--block-hover); }
.theme-picker .menu button.active { color: var(--accent); font-weight: 600; }
.theme-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); flex: none; }

/* ---------- Сетка ---------- */

main { padding-top: 20px; padding-bottom: 60px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.layout.single { grid-template-columns: minmax(0, 1fr); }

/* ---------- Блоки и категории ---------- */

.block { background: var(--block); border-radius: var(--radius); margin-bottom: 20px; }
.cat-head {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 14px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--banner);
}
.cat-head::before, .cat-head::after {
  content: ''; position: absolute; top: -30px; bottom: -30px; pointer-events: none;
  transform: skewX(-38deg); border-radius: 60px 0 0 60px;
}
.cat-head::before { right: 17%; width: 150px; background: var(--banner-stripe); opacity: .7; }
.cat-head::after { right: 6%; width: 90px; border: 10px solid rgba(255, 255, 255, .07); border-right: none; }
.cat-head h2 { position: relative; z-index: 1; margin: 0; font-size: 16px; font-weight: 700; color: #fff; }
.cat-head h2 a { color: #fff; }
.collapse {
  position: relative; z-index: 1; background: none; border: none; color: #fff; cursor: pointer;
  padding: 6px; display: flex; transition: transform .15s;
}
.collapsed .collapse { transform: rotate(180deg); }
.collapsed .block-body { display: none; }
.collapsed .cat-head { border-radius: var(--radius); }

/* ---------- Строка раздела ---------- */

.node { display: flex; align-items: center; gap: 14px; padding: 14px 14px; }
.node + .node { border-top: 1px solid rgba(255, 255, 255, .02); }
.node-icon {
  flex: none; width: 32px; height: 32px; border-radius: 2px;
  display: flex; align-items: center; justify-content: center; color: var(--faint);
}
.node-icon.new { background: var(--accent-dark); color: #fff; }
.node-main { flex: 1; min-width: 0; }
.node-title { font-size: 15px; font-weight: 700; color: #fff; }
.badge {
  display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 2px;
  background: var(--accent-strong); color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 18px; vertical-align: 1px;
}
.node-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.subforums { position: relative; margin-top: 2px; }
.subforums-toggle {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
}
.subforums-toggle:hover { color: var(--text); }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 220px;
  background: var(--header); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); padding: 6px 0;
}
.menu a { display: flex; align-items: center; gap: 8px; padding: 7px 14px; color: var(--text); }
.menu a:hover { background: var(--block-hover); text-decoration: none; }

.node-stats { flex: none; display: flex; text-align: center; margin: 0; }
.node-stats div { width: 76px; }
.node-stats div + div { border-left: 1px solid var(--border); }
.node-stats dt { font-size: 11px; color: var(--muted); }
.node-stats dd { margin: 2px 0 0; font-size: 14px; }

.node-last { flex: none; width: 230px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.node-last .lines { min-width: 0; }
.node-last .t { display: block; font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-last .m { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-last .none { color: var(--faint); font-size: 13px; font-style: italic; }

/* ---------- Аватары ---------- */

.avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 15px;
  text-transform: uppercase; user-select: none;
}
.avatar.xs { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 96px; height: 96px; font-size: 40px; }

/* ---------- Сайдбар ---------- */

.side-title { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 13px; margin: 14px 0 12px 12px; }
.side-block { background: var(--block); border-radius: var(--radius); padding: 6px 12px; margin-bottom: 20px; }
.recent-item { display: flex; gap: 10px; padding: 10px 0; }
.recent-item .avatar { width: 24px; height: 24px; font-size: 11px; }
.recent-item a { color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.recent-item .m { color: var(--faint); font-size: 12px; }
.recent-item .r { color: var(--muted); font-size: 12px; }
.stats-list { margin: 0; padding: 6px 0; font-size: 13px; }
.stats-list div { display: flex; justify-content: space-between; padding: 3px 0; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; }

/* ---------- Заголовки страниц и хлебные крошки ---------- */

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
h1 { font-size: 24px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.page-desc { color: var(--muted); margin-top: 4px; font-size: 13px; }

/* ---------- Кнопки и формы ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--accent-strong); color: var(--on-accent);
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--block-hover); }
.btn.small { padding: 4px 10px; font-size: 12px; font-weight: 500; }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: rgba(255, 107, 107, .1); }
.linkbtn { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.form-block { padding: 20px; }
.narrow { max-width: 440px; margin: 0 auto; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 13px; }
label:first-child { margin-top: 0; }
/* Поля ввода: цвета заданы жёстко, чтобы их не перекрашивали тёмные режимы браузеров и автозаполнение */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], textarea, select {
  -webkit-appearance: none; appearance: none;
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg) !important; color: var(--text) !important; -webkit-text-fill-color: var(--text);
  caret-color: var(--accent); font: inherit; opacity: 1;
}
select { background-image: none; }
input::placeholder, textarea::placeholder { color: #6b736f; -webkit-text-fill-color: #6b736f; opacity: 1; }
input:-webkit-autofill, input:-webkit-autofill:focus, input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  transition: background-color 9999s;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
input[type=file] { color: var(--muted); font-size: 13px; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); margin-top: 10px; }
.notice { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 12px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.file-list { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Список тем ---------- */

.block-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--muted); font-size: 13px; }
.topic { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.topic + .topic { border-top: 1px solid var(--border); }
.topic:hover { background: var(--block-hover); }
.topic-main { flex: 1; min-width: 0; }
.topic-title { font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.topic-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.topic-meta a { color: var(--muted); }
.topic .node-stats div { width: 90px; }
.topic-last { flex: none; width: 150px; text-align: right; font-size: 12px; color: var(--muted); }
.topic-last b { display: block; color: var(--text); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; justify-content: center; gap: 8px; margin: 16px 0; align-items: center; }

/* ---------- Сообщения темы ---------- */

.message { display: flex; background: var(--block); border-radius: var(--radius); margin-bottom: 14px; }
.message-user {
  flex: none; width: 160px; padding: 16px 10px; text-align: center;
  border-right: 1px solid var(--border); background: rgba(0, 0, 0, .12);
}
.message-user .avatar { margin: 0 auto 8px; }
.message-user .name { font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.role { display: inline-block; margin-top: 4px; padding: 1px 6px; border-radius: 2px; font-size: 11px; font-weight: 700; background: var(--accent-dark); color: #fff; }
.role.user { background: #333a37; color: var(--muted); font-weight: 500; }
.message-user .facts { margin-top: 8px; font-size: 11px; color: var(--muted); }
.message-main { flex: 1; min-width: 0; padding: 12px 16px; display: flex; flex-direction: column; }
.message-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.message-head a { color: var(--muted); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.quote {
  border-left: 3px solid var(--accent); background: rgba(0, 0, 0, .2);
  padding: 8px 12px; margin-bottom: 10px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.quote b { color: var(--text); }
.message.highlight { outline: 1px solid var(--accent); }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.attachments img { max-width: 240px; max-height: 200px; border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg);
  max-width: 100%; overflow-wrap: anywhere;
}
.file-chip .size { color: var(--muted); }

.post-foot { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.reaction {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 1px 9px; font: inherit; font-size: 13px; cursor: pointer;
}
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction:disabled { cursor: default; }
.picker { position: relative; }
.picker-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 5;
  background: var(--header); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px; display: flex; gap: 2px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.picker-menu button { border: none; background: none; font-size: 20px; cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.picker-menu button:hover { background: var(--accent-soft); }
.spacer { flex: 1; }
.replying-to { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- Админка ---------- */

.admin-cat { padding: 14px; }
.admin-cat + .admin-cat { border-top: 1px solid var(--border); }
.admin-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.admin-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.admin-row.sub { padding-left: 24px; }
.admin-row.cat .grow { font-weight: 700; color: var(--accent); }

.subtabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.subtabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--text); text-decoration: none; }
.subtabs a.active { color: #fff; border-bottom-color: var(--accent); }

.user-search { display: flex; gap: 8px; }
.user-row { display: flex; gap: 20px; padding: 14px; align-items: flex-start; flex-wrap: wrap; }
.user-row + .user-row { border-top: 1px solid var(--border); }
.user-info { flex: 1 1 260px; display: flex; gap: 10px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.user-info .role { margin-top: 0; vertical-align: 1px; }
.user-controls { flex: 1 1 380px; display: flex; flex-direction: column; gap: 8px; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
.prefix-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prefix-edit input[type=text] { flex: 1 1 200px; width: auto; }
.swatches { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); cursor: pointer; padding: 0; }
.swatches input[type=color] { width: 28px; height: 24px; padding: 0; border: none; background: none; cursor: pointer; }

/* ---------- Ники, значки, аватарки ---------- */

img.avatar { object-fit: cover; background: var(--bg); }
.avatar.xl { width: 128px; height: 128px; font-size: 52px; }
.avatar-link { display: inline-flex; flex: none; }
.avatar-link:hover { text-decoration: none; filter: brightness(1.1); }
.nick { display: inline-flex; align-items: center; gap: 4px; color: inherit; font-weight: inherit; }
.nick-badge { display: inline-flex; flex: none; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .5)); }
.message-user .name .nick { color: var(--accent); justify-content: center; }
.account .me { display: inline-flex; align-items: center; gap: 8px; }
.topic-meta .nick, .node-last .m .nick, .recent-item .m .nick { color: var(--muted); }
.topic-meta .nick[style], .node-last .m .nick[style], .recent-item .m .nick[style] { opacity: .95; }

/* ---------- Профиль ---------- */

.profile-card { background: var(--block); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.profile-cover { position: relative; height: 220px; overflow: hidden; }
.profile-head { display: flex; align-items: flex-end; gap: 18px; padding: 0 20px; margin-top: -64px; position: relative; flex-wrap: wrap; }
.profile-head .avatar.xl { border: 5px solid var(--block); box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.profile-id { flex: 1; min-width: 200px; padding-bottom: 8px; }
.profile-id h1 { display: flex; align-items: center; gap: 8px; font-size: 28px; font-weight: 700; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.profile-tags { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.profile-tags .role { margin-top: 0; }
.online { color: var(--accent); font-size: 12px; font-weight: 600; }
.profile-actions { display: flex; gap: 8px; padding-bottom: 12px; flex-wrap: wrap; }
.profile-stats { display: flex; flex-wrap: wrap; margin: 0; padding: 16px 20px; gap: 0; border-top: 1px solid var(--border); margin-top: 16px; }
.profile-stats div { flex: 1 1 110px; padding: 4px 12px; }
.profile-stats div + div { border-left: 1px solid var(--border); }
.profile-stats dt { color: var(--muted); font-size: 12px; }
.profile-stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; }
.section-title { margin: 0 0 12px; font-size: 15px; }

.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.social {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; max-width: 100%; overflow-wrap: anywhere;
}
.social:hover { border-color: var(--accent); text-decoration: none; }
.social span:last-child { color: var(--muted); }
.social-icon { display: inline-flex; flex: none; }
.social-grid label { gap: 6px; }
.profile-stats dd.streak { display: flex; align-items: center; gap: 6px; }

.badge-list { display: flex; flex-direction: column; gap: 6px; }
.badge-list.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.badge-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: 13px;
}
.badge-list.pick .badge-item { cursor: pointer; }
.badge-item.locked { opacity: .4; filter: grayscale(1); }
.badge-list.pick .badge-item.locked { cursor: not-allowed; }
.badge-item.active { border-color: var(--accent); background: var(--accent-soft); }
.no-badge { width: 22px; text-align: center; color: var(--muted); }

/* ---------- Настройки ---------- */

.narrow-wide { max-width: 860px; }
.avatar-edit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-edit .btn { margin-right: 6px; }
.nick-preview {
  display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg);
  border-radius: var(--radius); font-weight: 700; font-size: 16px;
}
.swatch.big { width: 26px; height: 26px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bg-tile {
  padding: 0; border: 2px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer;
  background: var(--bg); color: var(--text); font: inherit; font-size: 13px; text-align: center;
}
.bg-tile.active { border-color: var(--accent); }
.bg-tile > span { display: block; padding: 6px; }
.bg-tile-art { position: relative; height: 80px; overflow: hidden; pointer-events: none; }
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 14px; }
.social-grid label { display: flex; align-items: center; gap: 4px; }
.sticky-save {
  position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 0;
  border-top: 1px solid var(--border); z-index: 5;
}

/* ---------- Фоны профиля ---------- */

[data-bg] canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
[data-bg="classic"] { background: var(--banner); }
[data-bg="classic"]::before {
  content: ''; position: absolute; top: -40px; bottom: -40px; right: 20%; width: 35%;
  background: var(--banner-stripe); opacity: .6; transform: skewX(-38deg); border-radius: 80px 0 0 80px;
}

[data-bg="aurora"] { background: #03111a; }
[data-bg="aurora"] span { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .7; mix-blend-mode: screen; }
.aurora-a { width: 60%; height: 140%; left: -10%; top: -30%; background: #12e39a; animation: aurora1 9s ease-in-out infinite alternate; }
.aurora-b { width: 50%; height: 120%; left: 30%; top: -10%; background: #2f7bff; animation: aurora2 11s ease-in-out infinite alternate; }
.aurora-c { width: 45%; height: 120%; right: -10%; top: -20%; background: #b24bff; animation: aurora1 13s ease-in-out infinite alternate-reverse; }
@keyframes aurora1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(25%, 15%) scale(1.25); } }
@keyframes aurora2 { from { transform: translate(0, 10%) scale(1.1); } to { transform: translate(-25%, -10%) scale(.9); } }

[data-bg="neon"] { background: linear-gradient(180deg, #12002b 0%, #3b0a5c 55%, #12002b 100%); perspective: 300px; }
.neon-sun {
  position: absolute; left: 50%; bottom: 42%; width: 140px; height: 140px; margin-left: -70px; border-radius: 50%;
  background: linear-gradient(180deg, #ffe066 0%, #ff4d9d 70%);
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px);
  mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px);
  box-shadow: 0 0 60px #ff4d9d;
}
.neon-grid {
  position: absolute; left: -50%; right: -50%; bottom: -10%; height: 60%;
  background-image:
    linear-gradient(#ff2fd6 2px, transparent 2px),
    linear-gradient(90deg, #ff2fd6 2px, transparent 2px);
  background-size: 40px 40px;
  transform: rotateX(60deg); transform-origin: bottom;
  animation: neon-move 1.2s linear infinite;
  box-shadow: 0 -10px 40px rgba(255, 47, 214, .4);
  -webkit-mask: linear-gradient(to top, #000 40%, transparent);
  mask: linear-gradient(to top, #000 40%, transparent);
}
@keyframes neon-move { to { background-position: 0 40px; } }

@media (prefers-reduced-motion: reduce) {
  [data-bg] span { animation: none !important; }
}

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius);
  max-width: calc(100% - 32px); z-index: 100;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0 0; }
  .logo { font-size: 26px; }
  .account { gap: 12px; }
  .tabs { order: 3; width: 100%; height: 42px; overflow-x: auto; }
  .tabs a { padding: 0 10px; }
  .node-stats, .topic .node-stats { display: none; }
  .node-last { width: 160px; }
  .topic-last { display: none; }
  .message { flex-direction: column; }
  .message-user {
    width: auto; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .message-user .avatar { width: 36px; height: 36px; font-size: 15px; margin: 0; }
  .message-user .facts { margin: 0 0 0 auto; }
  .profile-cover { height: 150px; }
  .avatar.xl { width: 96px; height: 96px; font-size: 40px; }
  .profile-head { margin-top: -48px; padding: 0 16px; }
  .profile-stats div + div { border-left: none; }
}
@media (max-width: 560px) {
  .node { flex-wrap: wrap; }
  .node-last { width: 100%; padding-left: 46px; }
  .cat-head::before, .cat-head::after { display: none; }
}
