:root {
  --bg: #080b14;
  --card: rgba(255, 255, 255, 0.09);
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #f6f8ff;
  --muted: #aeb8d6;
  --accent: #75f7d4;
  --accent-2: #7c8cff;
  --accent-3: #ffb86b;
  --danger: #ff6d9e;
  --nick-admin: #ff6b81;
  --nick-user: #58e6b8;
  --nick-anon: #ffb86b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 22px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(117,247,212,0.18), transparent 34%),
    radial-gradient(circle at 85% 14%, rgba(124,140,255,0.22), transparent 35%),
    radial-gradient(circle at 52% 95%, rgba(255,184,107,0.12), transparent 32%),
    linear-gradient(135deg, #070914 0%, #10152a 48%, #080b14 100%);
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}
a { color: inherit; text-decoration: none; }
.page { position: relative; z-index: 1; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 60px; }

/* ---------- NAV ---------- */
.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 16px; border: 1px solid var(--card-border); border-radius: 24px;
  background: rgba(8,11,20,0.55); box-shadow: var(--shadow); backdrop-filter: blur(18px);
  position: sticky; top: 12px; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: 0.07em; }
.logo {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(135deg, rgba(117,247,212,0.95), rgba(124,140,255,0.95));
  color: #07101c; font-size: 18px; box-shadow: 0 12px 38px rgba(117,247,212,0.26);
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.07);
  border: 1px solid var(--card-border); border-radius: 999px; padding: 7px 14px; }
.search-box input { background: none; border: none; outline: none; color: var(--text); width: 160px; font-size: 14px; }
.search-box input::placeholder { color: var(--muted); }
.online-pill { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted);
  padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(117,247,212,0.2); background: rgba(117,247,212,0.06); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(117,247,212,0.14); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* ---------- BUTTONS ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  min-height: 42px; padding: 0 16px; border-radius: 13px; border: 1px solid transparent;
  font-weight: 800; font-size: 14px; transition: 0.18s ease; font-family: inherit; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-primary { color: #07101c; background: linear-gradient(135deg, var(--accent), #d8fff4); box-shadow: 0 12px 34px rgba(117,247,212,0.2); }
.btn-ghost { color: var(--text); background: rgba(255,255,255,0.08); border-color: var(--card-border); }
.btn-orange { color: #1a1206; background: linear-gradient(135deg, var(--accent-3), #ffd9a8); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn-danger { color: #fff; background: rgba(255,109,158,0.18); border: 1px solid rgba(255,109,158,0.4); }

/* ---------- CARDS / LAYOUT ---------- */
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 18px; align-items: start; }
.card { border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card);
  box-shadow: 0 18px 60px rgba(0,0,0,0.22); backdrop-filter: blur(18px); padding: 20px; }
.card + .card { margin-top: 16px; }
.side .card { padding: 18px; }
h1.page-title { font-size: clamp(30px, 5vw, 52px); letter-spacing: -0.05em; margin: 14px 0 4px; }
h1.page-title .grad { background: linear-gradient(90deg, var(--accent), #fff 55%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--muted); margin: 0 0 8px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin: 14px 0 6px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: 0.5; }

/* ---------- SECTIONS LIST ---------- */
.section-row { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 16px;
  border: 1px solid transparent; transition: 0.18s ease; cursor: pointer; }
.section-row:hover { background: rgba(255,255,255,0.05); border-color: var(--card-border); transform: translateY(-1px); }
.section-emoji { width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px; border-radius: 16px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); flex-shrink: 0; }
.section-row h3 { margin: 0 0 3px; font-size: 19px; letter-spacing: -0.02em; }
.section-row p { margin: 0; color: var(--muted); font-size: 14px; }
.section-stats { margin-left: auto; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; }
.section-stats b { color: var(--text); }
.divider { height: 1px; background: rgba(255,255,255,0.07); margin: 4px 0; }

/* ---------- TOPIC LIST ---------- */
.topic-row { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; cursor: pointer; transition: 0.16s; }
.topic-row:hover { background: rgba(255,255,255,0.05); }
.topic-main { min-width: 0; }
.topic-main h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topic-main .meta { color: var(--muted); font-size: 12.5px; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.03em; }
.tag.pin { color: var(--accent); background: rgba(117,247,212,0.12); border: 1px solid rgba(117,247,212,0.3); }
.tag.lock { color: var(--accent-3); background: rgba(255,184,107,0.12); border: 1px solid rgba(255,184,107,0.3); }
.tag.poll { color: var(--accent-2); background: rgba(124,140,255,0.14); border: 1px solid rgba(124,140,255,0.3); }
.topic-stat { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.topic-stat b { color: var(--text); font-size: 15px; }

/* ---------- MESSAGES ---------- */
.msg { display: flex; gap: 14px; padding: 18px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.avatar { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 900; font-size: 18px; color: #07101c; }
.msg-body { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.nick { font-weight: 800; }
.nick.admin { color: var(--nick-admin); }
.nick.user { color: var(--nick-user); }
.nick.anon { color: var(--nick-anon); }
.rank-badge { font-size: 11.5px; color: var(--muted); padding: 1px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); }
.ip-badge { font-size: 11px; color: var(--accent-3); font-family: "JetBrains Mono", monospace; opacity: 0.8; }
.msg-num { margin-left: auto; color: var(--muted); font-size: 12px; }
.msg-time { color: var(--muted); font-size: 12px; }
.msg-text { line-height: 1.6; font-size: 15px; word-break: break-word; }
.msg-text code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 6px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.msg-text a.link { color: var(--accent); text-decoration: underline; }
.msg-text a.mention { color: var(--accent-2); font-weight: 700; }
.quote { border-left: 3px solid var(--accent-2); padding: 6px 12px; margin-bottom: 10px; border-radius: 8px;
  background: rgba(124,140,255,0.08); font-size: 13px; color: var(--muted); }
.quote b { color: var(--text); }
.atts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; align-items: flex-start; }
.atts img { display: block; width: auto; max-width: min(100%, 420px); max-height: 420px; object-fit: contain; border-radius: 14px; border: 1px solid var(--card-border); cursor: zoom-in; background: rgba(8,11,20,0.45); box-shadow: 0 14px 36px rgba(0,0,0,0.22); }
.atts.one img { max-width: min(100%, 720px); max-height: 68vh; }
.msg-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.react-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.react { cursor: pointer; user-select: none; font-size: 13px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.05); transition: 0.14s; }
.react:hover { background: rgba(255,255,255,0.12); }
.react.mine { border-color: var(--accent); background: rgba(117,247,212,0.14); }
.karma-btn { cursor: pointer; font-weight: 800; font-size: 13px; padding: 4px 11px; border-radius: 999px;
  color: var(--accent); border: 1px solid rgba(117,247,212,0.35); background: rgba(117,247,212,0.08); transition: 0.14s; }
.karma-btn:hover { background: rgba(117,247,212,0.18); }
.karma-btn.voted { opacity: 0.55; cursor: default; }
.mini { font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.mini:hover { color: var(--text); background: rgba(255,255,255,0.07); }

/* ---------- COMPOSER ---------- */
.composer { border: 1px solid var(--card-border); border-radius: 16px; background: rgba(255,255,255,0.05); padding: 14px; margin-top: 16px; }
.composer textarea, .inp { width: 100%; background: rgba(8,11,20,0.5); border: 1px solid var(--card-border);
  border-radius: 12px; color: var(--text); padding: 12px; font-family: inherit; font-size: 15px; outline: none; resize: vertical; }
.composer textarea:focus, .inp:focus { border-color: rgba(117,247,212,0.4); }
.composer-tools { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.tool-btn { cursor: pointer; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.06); font-size: 14px; }
.tool-btn:hover { background: rgba(255,255,255,0.12); }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview { position: relative; }
.preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--card-border); }
.preview span { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; width: 20px; height: 20px;
  border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 12px; }
.reply-hint { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted);
  background: rgba(124,140,255,0.1); border: 1px solid rgba(124,140,255,0.25); padding: 7px 12px; border-radius: 10px; margin-bottom: 10px; }

.image-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 30px; background: rgba(3,6,14,0.88); backdrop-filter: blur(12px); }
.image-lightbox figure { margin: 0; max-width: min(1200px, 96vw); max-height: 92vh; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.image-lightbox img { max-width: 96vw; max-height: 84vh; object-fit: contain; border-radius: 18px; border: 1px solid rgba(255,255,255,0.18); background: rgba(8,11,20,0.65); box-shadow: 0 28px 90px rgba(0,0,0,0.45); }
.image-lightbox figcaption { color: var(--muted); font-size: 13px; text-align: center; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-lightbox-close, .image-lightbox-nav { border: 1px solid rgba(255,255,255,0.2); background: rgba(18,24,44,0.72); color: var(--text); cursor: pointer; box-shadow: var(--shadow); }
.image-lightbox-close { position: fixed; top: 18px; right: 20px; width: 42px; height: 42px; border-radius: 14px; font-size: 28px; line-height: 1; }
.image-lightbox-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 50px; height: 70px; border-radius: 18px; font-size: 44px; line-height: 1; }
.image-lightbox-prev { left: 22px; }
.image-lightbox-next { right: 22px; }
.image-lightbox-close:hover, .image-lightbox-nav:hover { background: rgba(117,247,212,0.18); border-color: rgba(117,247,212,0.45); }

/* emoji picker */
.emoji-pop { position: absolute; z-index: 80; margin-top: 6px; width: 280px; max-height: 220px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px; border-radius: 14px;
  background: rgba(10,14,26,0.97); border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.emoji-pop span { cursor: pointer; font-size: 20px; text-align: center; padding: 4px; border-radius: 8px; }
.emoji-pop span:hover { background: rgba(255,255,255,0.12); }

/* ---------- SIDEBAR ---------- */
.side h4 { margin: 0 0 12px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: var(--muted); }
.stat-line b { color: var(--text); }
.top-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 14px; }
.top-place { width: 22px; color: var(--muted); font-weight: 800; }
.online-list { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ---------- POLL ---------- */
.poll { border: 1px solid rgba(124,140,255,0.3); background: rgba(124,140,255,0.07); border-radius: 16px; padding: 18px; margin-bottom: 18px; }
.poll h3 { margin: 0 0 14px; font-size: 17px; }
.poll-opt { cursor: pointer; margin-bottom: 9px; }
.poll-bar { position: relative; border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; background: rgba(255,255,255,0.04); }
.poll-fill { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(117,247,212,0.3), rgba(124,140,255,0.3)); width: 0; transition: width 0.5s ease; }
.poll-label { position: relative; display: flex; justify-content: space-between; padding: 10px 13px; font-size: 14px; }
.poll-label .pct { font-weight: 800; }
.poll-foot { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* ---------- POPUPS ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,6,12,0.7); backdrop-filter: blur(6px); z-index: 200;
  display: grid; place-items: center; padding: 20px; }
.popup-layer { position: fixed; inset: 0; z-index: 240; pointer-events: none; display: flex; align-items: flex-start; justify-content: center; padding: 82px 18px 18px; }
.modal { width: min(440px, 100%); border: 1px solid var(--card-border); border-radius: 24px; background: rgba(12,16,28,0.96);
  box-shadow: var(--shadow); padding: 26px; }
.popup-card { pointer-events: auto; max-height: calc(100vh - 108px); overflow: auto; animation: popupIn 0.16s ease-out; }
.auth-popup { width: min(440px, calc(100vw - 26px)); }
.pm-compose-modal { width: min(560px, calc(100vw - 26px)); }
.link-popup, .link-modal, .confirm-popup { width: min(500px, calc(100vw - 26px)); }
.popup-actions { justify-content: flex-end; margin-top: 12px; }
.popup-confirm-text { margin: 8px 0 16px; color: var(--text); line-height: 1.55; }
.popup-close { float: right; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 0 6px 12px; }
.popup-close:hover { color: var(--text); }
@keyframes popupIn { from { opacity: 0; transform: translateY(-8px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal h2 { margin: 0 0 4px; letter-spacing: -0.03em; }
.modal p.hint { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: rgba(255,255,255,0.05); padding: 5px; border-radius: 12px; }
.tab { flex: 1; text-align: center; padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.tab.active { background: rgba(117,247,212,0.16); color: var(--text); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0; min-height: 16px; }
.modal-close { float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
@media (max-width: 640px) { .popup-layer { padding-top: 70px; } .popup-card { max-height: calc(100vh - 86px); } }

/* ---------- PROFILE / MISC ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; }
.profile-head .avatar { width: 76px; height: 76px; border-radius: 20px; font-size: 30px; }
.badge-big { display: inline-flex; gap: 7px; align-items: center; padding: 6px 14px; border-radius: 999px;
  background: rgba(117,247,212,0.1); border: 1px solid rgba(117,247,212,0.3); font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.sentinel { height: 1px; }
.loader { text-align: center; color: var(--muted); padding: 18px; font-size: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: rgba(12,16,28,0.97); border: 1px solid var(--card-border); padding: 13px 20px; border-radius: 14px;
  box-shadow: var(--shadow); font-weight: 700; animation: pop 0.25s ease; }
.toast.ok { border-color: rgba(117,247,212,0.5); }
.toast.bad { border-color: rgba(255,109,158,0.5); }
@keyframes pop { from { transform: translate(-50%, 12px); opacity: 0; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip-toggle { display: flex; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; border: 1px solid var(--card-border); background: rgba(255,255,255,0.05); color: var(--muted); }
.chip.active { color: var(--text); border-color: var(--accent); background: rgba(117,247,212,0.12); }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .side { order: -1; }
  .search-box input { width: 110px; }
}
@media (max-width: 560px) {
  .nav { flex-direction: column; align-items: stretch; }
  .nav-right { flex-wrap: wrap; }
  .atts img, .atts.one img { max-width: 100%; max-height: 70vh; }
  .image-lightbox { padding: 16px; }
  .image-lightbox-nav { width: 42px; height: 58px; font-size: 34px; }
  .image-lightbox-prev { left: 8px; }
  .image-lightbox-next { right: 8px; }
}

/* ---------- РОЛИ / МОДЕРАЦИЯ ---------- */
.nick.moderator { color: var(--accent-2); }
.staff-tag { font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; }
.staff-tag.admin { color: var(--nick-admin); background: rgba(255,107,129,0.14); border: 1px solid rgba(255,107,129,0.35); }
.staff-tag.mod   { color: var(--accent-2); background: rgba(124,140,255,0.14); border: 1px solid rgba(124,140,255,0.35); }
.staff-tag.smod  { color: var(--accent-3); background: rgba(255,184,107,0.14); border: 1px solid rgba(255,184,107,0.35); }

.ban-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; margin: 12px 0;
  background: rgba(255,109,158,0.12); border: 1px solid rgba(255,109,158,0.4); color: #ffd0de; font-size: 14px; }
.banned-name { text-decoration: line-through; opacity: 0.7; }

.mlog { font-size: 13px; }
.mlog-row { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.05); flex-wrap: wrap; }
.mlog-act { font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.07); border: 1px solid var(--card-border); }
.mlog-act.ban, .mlog-act.autoban { color: var(--nick-admin); }
.mlog-act.unban { color: var(--nick-user); }
.mlog-act.karma { color: var(--accent-3); }
.mlog-time { margin-left: auto; color: var(--muted); }

.role-select { background: rgba(8,11,20,0.6); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 9px; padding: 6px 8px; font-family: inherit; font-size: 13px; }
.user-card { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06); flex-wrap: wrap; }
.user-card .grow { flex: 1; min-width: 180px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-banned { color: var(--nick-admin); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; border: 1px solid rgba(255,107,129,0.4); }
.section-mod-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.smod-chip { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: rgba(255,184,107,0.1); border: 1px solid rgba(255,184,107,0.3); color: var(--accent-3); display: inline-flex; gap: 6px; align-items: center; }
.smod-chip b { cursor: pointer; color: var(--nick-admin); }

/* ---------- ДОРАБОТКИ: навигация / аватары / редактор ---------- */
#authArea { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-link { color: var(--muted); font-size: 13px; font-weight: 800; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--card-border); background: rgba(255,255,255,0.05); white-space: nowrap; }
.home-link:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.user-pill { gap: 8px; }
.user-pill .avatar { border-radius: 8px; font-size: 11px; }
.avatar { object-fit: cover; border: 1px solid rgba(255,255,255,0.18); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }
.editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  position: sticky;
  top: var(--editor-sticky-top, 86px);
  z-index: 45;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px;
  background: rgba(20,25,43,0.92);
  box-shadow: 0 14px 34px rgba(0,0,0,0.22);
  backdrop-filter: blur(16px);
}

.editor-bar.editor-bar-fixed {
  position: fixed;
  top: var(--editor-sticky-top, 86px);
  left: var(--editor-fixed-left, 12px);
  width: var(--editor-fixed-width, auto);
  max-width: calc(100vw - 24px);
  z-index: 120;
  margin-bottom: 0;
}
.editor-bar-spacer {
  display: none;
  height: var(--editor-bar-height, 52px);
  margin-bottom: 8px;
}
.editor-bar-spacer.active { display: block; }

.editor-btn { min-width: 36px; justify-content: center; font-weight: 900; }
.editor-preview { margin-top: 10px; padding: 12px; border: 1px solid var(--card-border); border-radius: 12px; background: rgba(8,11,20,0.35); line-height: 1.6; color: var(--text); }
.nick.moderator { color: var(--accent-3); }
.staff-tag.mod { color: var(--accent-3); background: rgba(255,184,107,0.14); border-color: rgba(255,184,107,0.35); }

@media (max-width: 720px) {
  .nav-right { gap: 8px; }
  #authArea { width: 100%; }
  #authArea .btn, #authArea .online-pill { flex: 1 1 auto; }
  .home-link { flex: 1 1 auto; text-align: center; }
}
.msg-text blockquote,
.editor-preview blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent-2);
  border-radius: 9px;
  background: rgba(124,140,255,0.08);
  color: var(--muted);
}
.edit-actions { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.nav-right { flex-wrap: wrap; justify-content: flex-end; }
.home-link { letter-spacing: 0.06em; }

/* ---------- WYSIWYG editor ---------- */
.wysiwyg-editor {
  width: 100%;
  min-height: 108px;
  background: rgba(8,11,20,0.5);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  word-break: break-word;
}
.wysiwyg-editor:focus { border-color: rgba(117,247,212,0.4); }
.wysiwyg-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.75;
  pointer-events: none;
}
.wysiwyg-editor h1, .msg-h1 { margin: 4px 0 8px; font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; }
.wysiwyg-editor h2, .msg-h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; }
.wysiwyg-editor h3, .msg-h3 { margin: 4px 0 8px; font-size: 18px; line-height: 1.25; }
.wysiwyg-editor blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent-2); border-radius: 9px; background: rgba(124,140,255,0.08); color: var(--muted); }
.wysiwyg-editor code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 6px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.editor-select {
  height: 34px;
  max-width: 136px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 0 9px;
  outline: none;
}
.editor-select option { background: #10152a; color: var(--text); }
.text-red { color: #ff6d9e; }
.text-orange { color: #ffb86b; }
.text-yellow { color: #ffd166; }
.text-green { color: #75f7d4; }
.text-blue { color: #7c8cff; }
.text-purple { color: #c084fc; }
.text-gray { color: #aeb8d6; }
.text-white { color: #ffffff; }
.msg-text mark, .wysiwyg-editor mark {
  color: #07101c;
  background: #ffd166;
  padding: 0 4px;
  border-radius: 4px;
}
.msg-text mark.mark-yellow, .wysiwyg-editor mark.mark-yellow { color: #07101c; background: #ffd166; }
.msg-text mark.mark-white, .wysiwyg-editor mark.mark-white { color: #07101c; background: #ffffff; }
.msg-text mark.mark-green, .wysiwyg-editor mark.mark-green { color: #07101c; background: #75f7d4; }
.msg-text mark.mark-blue, .wysiwyg-editor mark.mark-blue { color: #07101c; background: #9aa7ff; }
.msg-text mark.mark-red, .wysiwyg-editor mark.mark-red { color: #07101c; background: #ff9dbb; }


.editor-bar .tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  line-height: 1;
}
button.tool-btn {
  color: var(--text);
  font-family: inherit;
}
.wysiwyg-editor u,
.msg-text u { text-underline-offset: 3px; }
.wysiwyg-editor ul,
.wysiwyg-editor ol { margin: 6px 0 8px 22px; padding-left: 14px; }
.wysiwyg-editor li { margin: 3px 0; }
.msg-li { padding-left: 8px; margin: 2px 0; }
.karma-vote-wrap { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.karma-btn.karma-down { color: var(--danger); border-color: rgba(255,109,158,0.35); background: rgba(255,109,158,0.08); }
.karma-btn.karma-down:hover { background: rgba(255,109,158,0.18); }
.karma-sum { font-size: 12.5px; color: var(--muted); font-weight: 800; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.link-modal .edit-actions { justify-content: flex-end; }

@media (max-width: 720px) {
  .editor-bar { top: var(--editor-sticky-top, 12px); max-height: 42vh; overflow-y: auto; }
}

/* Глобальная плавающая панель редактора — не зависит от высоты поста и контейнеров */
.editor-bar-global {
  position: fixed !important;
  top: var(--editor-sticky-top, 86px) !important;
  left: var(--editor-fixed-left, 12px) !important;
  width: var(--editor-fixed-width, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px);
  z-index: 1000;
  margin: 0;
}
.msg-actions-top {
  margin: 0 0 10px;
  padding: 7px 9px;
  width: fit-content;
  max-width: 100%;
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
}


/* ---------- TAGS ---------- */
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 4px; }
.tag-user { color: var(--accent); background: rgba(117,247,212,0.10); border: 1px solid rgba(117,247,212,0.28); cursor: pointer; }
.tag-user:hover { color: #07101c; background: linear-gradient(135deg, var(--accent), #d8fff4); border-color: rgba(117,247,212,0.55); }
.topic-head-tags { margin-top: 10px; margin-bottom: 8px; }
.topic-tags { margin-top: 2px; margin-bottom: 5px; }
.message-tags { margin-bottom: 8px; }
.topic-tag-edit { margin: 8px 0 12px; }
.tag-field { margin-bottom: 10px; }
.field-hint { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }

/* Rich snippets in profile/search cards: render saved formatting, not raw tags */
.rich-snippet {
  line-height: 1.55;
  max-height: 4.8em;
  overflow: hidden;
}
.rich-snippet :is(div, p) {
  display: inline;
  margin: 0;
}
.rich-snippet br {
  display: none;
}
.rich-snippet :is(h1, h2, h3) {
  display: inline;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}
.rich-snippet blockquote {
  display: inline;
  margin: 0;
  padding: 0 0 0 8px;
  border-left: 2px solid rgba(117, 247, 212, 0.45);
}
.rich-snippet ul,
.rich-snippet ol {
  display: inline;
  margin: 0;
  padding-left: 18px;
}
.rich-snippet li {
  display: inline;
  margin-right: 6px;
}
.rich-snippet code {
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
}
.rich-snippet mark {
  border-radius: 5px;
  padding: 0 3px;
}
.rich-snippet .snippet-time {
  color: var(--muted);
  white-space: nowrap;
}

.form-row-link {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 10px;
}
.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 0;
}
.link-button:hover { text-decoration: underline; }
.auth-card { max-width: 480px; margin: 0 auto; }

/* Inline topic tags editor */
.inline-topic-tags {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
}
.mini-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topic-tag-edit-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.topic-tags-input {
  min-height: 38px;
}
@media (max-width: 720px) {
  .topic-tag-edit-row { grid-template-columns: 1fr; }
  .topic-tag-edit-row .btn { width: 100%; }
}

/* Private messages */
.pm-nav-btn b, .pm-unread {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}
.pm-thread {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  cursor: pointer;
}
.pm-thread:hover { background: rgba(255,255,255,0.035); }
.pm-thread.unread .meta { color: var(--text); }
.pm-dialog-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.pm-message-list {
  max-height: min(62vh, 720px);
  overflow: auto;
  padding: 8px 4px 16px;
}
.pm-message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin: 10px 0;
}
.pm-message.mine { justify-content: flex-end; }
.pm-bubble {
  max-width: min(720px, 78%);
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  line-height: 1.55;
  word-break: break-word;
}
.pm-message.mine .pm-bubble {
  background: linear-gradient(135deg, rgba(117,247,212,0.16), rgba(124,140,255,0.12));
  border-color: rgba(117,247,212,0.28);
}
.pm-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.pm-reply {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.pm-textarea {
  min-height: 110px;
  resize: vertical;
}
.pm-compose-modal { width: min(560px, 100%); }
@media (max-width: 640px) {
  .pm-reply { grid-template-columns: 1fr; }
  .pm-bubble { max-width: 92%; }
}

/* Admin section editor */
.admin-section-card {
  padding: 14px;
  margin: 10px 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  background: rgba(255,255,255,0.045);
}
.admin-section-edit {
  display: grid;
  grid-template-columns: 58px minmax(220px, 1fr) 78px auto auto;
  gap: 10px;
  align-items: start;
}
.admin-section-edit .grow {
  display: grid;
  gap: 8px;
}
.sec-icon-input {
  text-align: center;
  font-size: 24px;
  min-height: 48px;
}
.sec-pos-input {
  text-align: center;
}
.section-mod-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.section-mod-current,
.section-mod-add {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.section-mod-add .inp {
  max-width: 340px;
}
.msg-highlight {
  animation: msgFlash 3.2s ease;
}
@keyframes msgFlash {
  0%, 70% { box-shadow: 0 0 0 2px rgba(117,247,212,0.65), 0 0 42px rgba(117,247,212,0.22); }
  100% { box-shadow: none; }
}
@media (max-width: 760px) {
  .admin-section-edit { grid-template-columns: 54px 1fr; }
  .admin-section-edit .sec-pos-input,
  .admin-section-edit .btn { grid-column: span 2; width: 100%; }
  .section-mod-add { display: grid; grid-template-columns: 1fr; }
  .section-mod-add .inp { max-width: none; }
}

/* ---------- BETTER SECTION EDITING ---------- */
.admin-section-summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.section-preview-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 26px;
  background: rgba(255,255,255,0.065);
  border: 1px solid rgba(255,255,255,0.10);
}
.admin-section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-section-title-row h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.admin-section-desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  margin: 4px 0 3px;
}
.admin-section-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.admin-section-card.editing {
  border-color: rgba(117,247,212,0.34);
  background: rgba(117,247,212,0.055);
}
.admin-section-edit-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(117,247,212,0.22);
  background: rgba(8,11,20,0.36);
}
.section-edit-grid {
  display: grid;
  grid-template-columns: 90px minmax(220px, 1fr) 120px;
  gap: 10px;
  align-items: start;
}
.section-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.section-edit-grid label.wide {
  grid-column: 1 / -1;
}
.section-edit-grid textarea.inp {
  min-height: 86px;
  resize: vertical;
}
.section-mod-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 760px) {
  .admin-section-summary { grid-template-columns: 50px 1fr; }
  .admin-section-buttons { grid-column: 1 / -1; justify-content: stretch; }
  .admin-section-buttons .btn { flex: 1; }
  .section-edit-grid { grid-template-columns: 1fr; }
}

/* ---------- QUIETER TOPIC MESSAGE CHROME ---------- */
.msg .avatar {
  width: 42px;
  height: 42px;
  opacity: 0.72;
  filter: saturate(0.82);
}
.msg-head {
  opacity: 0.68;
  font-size: 13px;
  transition: opacity 0.16s ease;
}
.msg-head .nick {
  font-weight: 700;
}
.msg-head .staff-tag,
.msg-head .rank-badge,
.msg-head .ip-badge,
.msg-time,
.msg-num {
  opacity: 0.72;
}
.message-tags,
.topic-tags,
.topic-head-tags {
  opacity: 0.68;
  transition: opacity 0.16s ease;
}
.message-tags .tag,
.topic-tags .tag,
.topic-head-tags .tag {
  font-size: 10.5px;
  padding: 1px 7px;
}
.msg-actions-top {
  opacity: 0.42;
  transition: opacity 0.16s ease, background 0.16s ease;
}
.msg-actions:not(.msg-actions-top) {
  opacity: 0.72;
  transition: opacity 0.16s ease;
}
.msg:hover .avatar,
.msg:hover .msg-head,
.msg:hover .message-tags,
.msg:hover .msg-actions,
.msg:focus-within .avatar,
.msg:focus-within .msg-head,
.msg:focus-within .message-tags,
.msg:focus-within .msg-actions {
  opacity: 1;
  filter: none;
}
.msg-text {
  margin-top: 6px;
  font-size: 15.6px;
}

/* ---------- SECTION ICON PICKER ---------- */
.section-icon-picker {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: start;
}
.section-icon-current {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 27px;
  background: rgba(117,247,212,0.10);
  border: 1px solid rgba(117,247,212,0.24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}
.section-icon-grid {
  display: grid;
  grid-template-columns: repeat(10, 34px);
  gap: 6px;
  align-items: center;
}
.section-icon-choice {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.055);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  transition: 0.16s ease;
}
.section-icon-choice:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.10);
  border-color: rgba(117,247,212,0.25);
}
.section-icon-choice.active {
  background: rgba(117,247,212,0.16);
  border-color: rgba(117,247,212,0.52);
  box-shadow: 0 0 0 2px rgba(117,247,212,0.08);
}
#secList .section-icon-picker {
  grid-column: 1 / -1;
}
@media (max-width: 760px) {
  .section-icon-picker { grid-template-columns: 1fr; }
  .section-icon-current { width: 100%; }
  .section-icon-grid { grid-template-columns: repeat(5, 1fr); }
  .section-icon-choice { width: 100%; }
}

/* ---------- SECTION ICON PICKER LAYOUT FIX ---------- */
.section-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}
.section-create-form label,
.section-edit-grid label {
  min-width: 0;
}
.section-create-form label span,
.section-edit-grid label span {
  display: block;
  margin-bottom: 6px;
}
.section-create-form .section-icon-label,
.section-edit-grid .section-icon-label {
  grid-column: 1 / -1;
}
.section-icon-picker {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
.section-icon-grid {
  grid-template-columns: repeat(auto-fill, minmax(34px, 34px));
  max-width: 100%;
}
.section-icon-choice {
  position: relative;
  z-index: 1;
}
.section-icon-choice.active {
  z-index: 2;
}
@media (max-width: 900px) {
  .section-create-form { grid-template-columns: 1fr; }
  .section-create-form .btn { width: 100%; }
}

/* ---------- SECTION PIN + PAGINATION + USER AUTOCOMPLETE ---------- */
.check-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.045);
  color: var(--muted);
  font-weight: 800;
}
.check-inline input { accent-color: var(--accent); }
.section-pin-check { white-space: nowrap; }
.section-row.pinned {
  border-color: rgba(117,247,212,0.24);
  background: linear-gradient(90deg, rgba(117,247,212,0.075), rgba(255,255,255,0.035));
}
.section-pin-tag { margin-right: 8px; }
.section-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.075);
}
.section-page-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  min-width: 70px;
  text-align: center;
}
.user-suggest-pop {
  position: fixed;
  z-index: 9999;
  max-height: 310px;
  overflow: auto;
  padding: 7px;
  border-radius: 16px;
  border: 1px solid rgba(117,247,212,0.24);
  background: rgba(13, 18, 34, 0.98);
  box-shadow: 0 18px 70px rgba(0,0,0,0.46);
  backdrop-filter: blur(18px);
}
.user-suggest-pop[hidden] { display: none; }
.user-suggest-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: center;
  padding: 8px 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.user-suggest-item:hover,
.user-suggest-item.active {
  background: rgba(117,247,212,0.12);
}
.user-suggest-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.mention-suggest-pop { width: 280px; }
@media (max-width: 760px) {
  .section-pager { justify-content: stretch; }
  .section-pager .btn { flex: 1; }
  .section-pin-check { width: 100%; justify-content: center; }
}
.section-create-form {
  grid-template-columns: minmax(190px, 1fr) minmax(240px, 1.2fr) auto auto;
}
@media (max-width: 1050px) {
  .section-create-form { grid-template-columns: 1fr 1fr; }
  .section-create-form .section-icon-label { grid-column: 1 / -1; }
}

/* ---------- SECTION TREE + BETTER SUBSECTION MANAGEMENT ---------- */
.section-children {
  margin: 8px 0 0 36px;
  padding-left: 16px;
  border-left: 1px solid rgba(117,247,212,0.18);
}
.section-row-child {
  margin-top: 8px;
  background: rgba(255,255,255,0.032);
}
.section-row-child .section-emoji.small {
  width: 40px;
  height: 40px;
  font-size: 20px;
  opacity: 0.82;
}
.admin-subsections {
  margin: 12px 0 0 28px;
  padding-left: 16px;
  border-left: 1px solid rgba(117,247,212,0.18);
}
.admin-section-card.subsection-card {
  background: rgba(255,255,255,0.032);
}
.section-create-form,
.section-edit-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
}
.section-create-form label.wide,
.section-edit-grid label.wide,
.section-create-form .section-icon-label,
.section-edit-grid .section-icon-label {
  grid-column: 1 / -1;
}
.section-create-form .section-pin-check,
.section-edit-grid .section-pin-check {
  justify-content: flex-start;
  white-space: normal;
}
.child-create-panel {
  border-color: rgba(124,140,255,0.22);
}
.admin-section-title-row .rank-badge {
  opacity: 0.72;
}
@media (max-width: 760px) {
  .section-children,
  .admin-subsections {
    margin-left: 12px;
    padding-left: 10px;
  }
  .section-create-form,
  .section-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* Section page subsection creation */
.section-topic-head {
  margin-bottom: 14px;
  gap: 12px;
}
.section-topic-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.section-inline-child-panel {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(117,247,212,0.20);
  border-radius: 18px;
  background: rgba(11, 18, 32, 0.58);
}
.section-inline-title {
  margin: 0 0 12px;
  font-weight: 900;
  color: var(--accent);
}
.inline-child-form {
  margin: 0;
}
@media (max-width: 760px) {
  .section-topic-head {
    align-items: stretch;
    flex-direction: column;
  }
  .section-topic-actions {
    justify-content: flex-start;
  }
  .section-topic-actions .chip-toggle,
  .section-topic-actions .btn {
    width: 100%;
  }
}

/* Section page: show subsections above topics */
.section-subsections-card {
  margin-bottom: 14px;
}
.section-subsections-head {
  margin-bottom: 10px;
}
.section-page-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section-page-children.depth-2,
.section-page-children.depth-3,
.section-page-children.depth-4,
.section-page-children.depth-5 {
  margin-left: 28px;
  padding-left: 14px;
  border-left: 1px solid rgba(117,247,212,0.16);
}
.section-page-child-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  background: rgba(255,255,255,0.035);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.section-page-child-row:hover {
  border-color: rgba(117,247,212,0.35);
  background: rgba(117,247,212,0.06);
  transform: translateY(-1px);
}
.section-page-child-row.pinned {
  border-color: rgba(117,247,212,0.22);
  background: linear-gradient(90deg, rgba(117,247,212,0.07), rgba(255,255,255,0.03));
}
.section-page-child-main h3 {
  margin: 0 0 3px;
  font-size: 15px;
}
.section-page-child-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
@media (max-width: 760px) {
  .section-page-child-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .section-page-child-row .section-stats {
    grid-column: 2;
    text-align: left;
  }
  .section-page-children.depth-2,
  .section-page-children.depth-3,
  .section-page-children.depth-4,
  .section-page-children.depth-5 {
    margin-left: 12px;
    padding-left: 10px;
  }
}

/* Collapsed subsections by default */
.section-node,
.section-page-node {
  min-width: 0;
}
.section-toggle {
  margin: 8px 0 0 56px;
  opacity: 0.78;
  font-size: 12px;
}
.section-toggle:hover {
  opacity: 1;
}
.section-page-toggle {
  margin-left: 52px;
}
.section-children[hidden],
.section-page-children[hidden] {
  display: none !important;
}
.section-subsections-head .btn {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .section-toggle,
  .section-page-toggle {
    margin-left: 0;
    width: 100%;
  }
  .section-subsections-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* === INHEX feature pack === */
.quick-card { display:flex; flex-direction:column; gap:8px; }
.quick-link { display:block; padding:9px 11px; border-radius:12px; color:var(--muted); background:rgba(255,255,255,.035); border:1px solid rgba(255,255,255,.07); }
.quick-link:hover { color:var(--text); background:rgba(117,247,212,.08); border-color:rgba(117,247,212,.22); }
.feature-box { margin:14px 0 8px; padding:14px; border:1px solid rgba(117,247,212,.18); border-radius:18px; background:rgba(255,255,255,.045); }
.feature-line { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.feature-admin { margin-top:12px; display:grid; gap:9px; grid-template-columns: minmax(150px,220px) auto auto 1fr auto; align-items:center; }
.feature-admin textarea { min-height:42px; resize:vertical; }
.topic-summary, .best-answer, .similar-box { margin-top:12px; padding:10px 12px; border-radius:14px; background:rgba(0,0,0,.16); color:var(--text); }
.similar-box { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.similar-box a { padding:6px 10px; border-radius:999px; background:rgba(255,255,255,.07); color:var(--accent); }
.tag.status { background:rgba(124,140,255,.14); color:#d7dcff; border-color:rgba(124,140,255,.3); }
.tag.heat { background:rgba(255,184,107,.12); color:#ffd9a6; border-color:rgba(255,184,107,.24); }
.tag.kb { background:rgba(117,247,212,.12); color:var(--accent); border-color:rgba(117,247,212,.26); }
.mini-topic { cursor:pointer; margin-top:8px; }
.solution-msg .msg-body { border-color:rgba(117,247,212,.45); box-shadow:0 0 0 1px rgba(117,247,212,.12); }
.solution-label { display:inline-flex; width:max-content; margin-bottom:8px; padding:4px 9px; border-radius:999px; background:rgba(117,247,212,.13); color:var(--accent); font-weight:800; font-size:12px; }
.deleted-msg .msg-text { opacity:.68; font-style:italic; }
.spoiler { margin:8px 0; padding:8px 10px; border-radius:12px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.12); }
.spoiler summary { cursor:pointer; font-weight:800; color:var(--accent); }
.note { margin:10px 0; padding:11px 13px; border-radius:14px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.055); }
.note-important { border-color:rgba(255,184,107,.35); background:rgba(255,184,107,.09); }
.note-warn { border-color:rgba(255,109,158,.35); background:rgba(255,109,158,.08); }
.note-tip { border-color:rgba(117,247,212,.35); background:rgba(117,247,212,.07); }
.code-block-msg { position:relative; margin:10px 0; padding:34px 12px 12px; overflow:auto; border-radius:14px; background:#080b14; border:1px solid rgba(255,255,255,.11); }
.code-block-msg code { white-space:pre; font-family:"JetBrains Mono",Consolas,monospace; }
.copy-code { position:absolute; right:8px; top:7px; padding:4px 8px; border-radius:9px; border:1px solid rgba(255,255,255,.15); background:rgba(255,255,255,.07); color:var(--muted); cursor:pointer; }
.topic-type-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:10px; }
.hex-dot { display:inline-block; width:14px; height:14px; margin-right:8px; border-radius:50%; box-shadow:0 0 0 5px rgba(255,255,255,.05); vertical-align:middle; }
.profile-bio { margin-top:12px; padding:12px 14px; border-radius:16px; background:rgba(255,255,255,.04); }
.badge-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
@media (max-width: 820px) { .feature-admin { grid-template-columns:1fr; } }

/* ---------- ERGONOMIC TOPIC CONTROLS ---------- */
.msg {
  padding-top: 20px;
  padding-bottom: 20px;
}
.msg-body {
  position: relative;
}
.msg-text {
  color: rgba(246, 248, 255, 0.98);
  font-size: 16px;
  line-height: 1.72;
}
.msg-actions {
  gap: 6px;
  opacity: 0.46;
}
.msg-actions-top {
  margin-top: 2px;
  margin-bottom: 4px;
  justify-content: flex-end;
  opacity: 0.24;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 0.88;
}
.msg:hover .msg-actions-top,
.msg:focus-within .msg-actions-top {
  opacity: 0.72;
}
.msg-actions .mini,
.post-more summary {
  color: rgba(174, 184, 214, 0.68);
  border: 1px solid transparent;
  background: transparent;
}
.msg-actions .mini:hover,
.post-more summary:hover {
  color: var(--text);
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.08);
}
.primary-action {
  font-weight: 700;
}
.post-more {
  position: relative;
  display: inline-block;
}
.post-more summary {
  list-style: none;
  user-select: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12.5px;
}
.post-more summary::-webkit-details-marker {
  display: none;
}
.post-more-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 35;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(8, 11, 20, 0.96);
  box-shadow: 0 18px 55px rgba(0,0,0,0.42);
  backdrop-filter: blur(14px);
}
.msg-actions-top .post-more-menu {
  top: calc(100% + 8px);
  bottom: auto;
}
.post-more-menu .mini,
.post-more-menu .karma-vote-wrap {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
}
.post-more-menu .mini {
  padding: 8px 10px;
  border-radius: 10px;
}
.post-more-menu .danger-mini {
  color: rgba(255,109,158,0.9);
}
.post-more-menu .karma-vote-wrap {
  gap: 6px;
  padding: 5px 6px;
}
.react-bar {
  opacity: 0.68;
}
.react {
  opacity: 0.72;
  background: rgba(255,255,255,0.025);
}
.react:hover,
.react.mine {
  opacity: 1;
}
.message-tags,
.quote,
.msg-head,
.msg .avatar {
  opacity: 0.58;
}
.msg:hover .message-tags,
.msg:hover .quote,
.msg:hover .msg-head,
.msg:hover .avatar,
.msg:focus-within .message-tags,
.msg:focus-within .quote,
.msg:focus-within .msg-head,
.msg:focus-within .avatar {
  opacity: 0.9;
}
@media (max-width: 760px) {
  .msg-actions-top { justify-content: flex-start; }
  .post-more-menu { right: auto; left: 0; min-width: min(78vw, 260px); }
}

/* ---------- TOPIC ERGONOMICS: compact by default, readable controls ---------- */
.feature-box-compact {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-color: rgba(117,247,212,.16);
  background: rgba(255,255,255,.032);
}
.topic-control-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.topic-control-status {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.topic-advanced-toggle {
  opacity: .86;
}
.topic-advanced-toggle.active,
.topic-advanced-toggle:hover {
  opacity: 1;
  border-color: rgba(117,247,212,.28);
  background: rgba(117,247,212,.08);
}
.topic-advanced-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.topic-advanced-panel[hidden] {
  display: none !important;
}
.feature-actions {
  margin-bottom: 10px;
}
.topic-tags-panel {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(0,0,0,.12);
}
.topic-tags-panel .inline-topic-tags {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.topic-tags-panel .topic-head-tags {
  margin: 4px 0 2px;
}

/* make post controls calmer, but not invisible */
.msg-actions {
  opacity: .74;
}
.msg-actions-top {
  opacity: .62;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg:hover .msg-actions-top,
.msg:focus-within .msg-actions-top {
  opacity: 1;
}
.msg-actions .mini,
.post-more summary {
  color: rgba(210, 218, 242, .82);
  background: rgba(255,255,255,.028);
  border-color: rgba(255,255,255,.045);
}
.msg-actions .mini:hover,
.post-more summary:hover {
  color: #f6f8ff;
  background: rgba(255,255,255,.085);
  border-color: rgba(255,255,255,.12);
}
.primary-action {
  color: rgba(218, 226, 255, .9) !important;
}
.danger-mini {
  color: rgba(255, 125, 165, .9) !important;
}
.post-more-menu {
  background: rgba(12, 16, 30, .985);
  border-color: rgba(255,255,255,.16);
}
.post-more-menu .mini,
.post-more-menu .karma-vote-wrap {
  opacity: 1;
}
.react-bar,
.react {
  opacity: .86;
}
.message-tags,
.quote,
.msg-head,
.msg .avatar {
  opacity: .72;
}
.msg:hover .message-tags,
.msg:hover .quote,
.msg:hover .msg-head,
.msg:hover .avatar,
.msg:focus-within .message-tags,
.msg:focus-within .quote,
.msg:focus-within .msg-head,
.msg:focus-within .avatar {
  opacity: .94;
}
.msg-text {
  position: relative;
  z-index: 1;
}
@media (max-width: 760px) {
  .topic-control-compact { align-items: stretch; }
  .topic-control-status, .topic-advanced-toggle { width: 100%; }
  .topic-advanced-toggle { justify-content: center; }
}
