:root {
  --bg: #131517;
  --bg-elev: #181a1d;
  --panel: #1c1e22;
  --panel-2: #20232a;
  --border: #2c3035;
  --hair: #242830;
  --text: #d6dadd;
  --muted: #8b9097;
  --strong: #f4f6f8;
  --accent: #685497;
  --accent-dim: #594098;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --tight: -0.005em;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #0d0e10; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--strong); }
.accent { color: var(--accent); }
.meta { color: var(--muted); font-size: 13px; }
.err { color: #ff7777; }
.grow { flex: 1; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

button, input, textarea, select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 11px;
  font: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-dim); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); }
button { cursor: pointer; }
button:hover { color: var(--strong); border-color: var(--muted); }
button.link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--muted);
}
button.link:hover { color: var(--accent); }
form.inline { display: inline; }

.nav {
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 0;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--hair);
  position: relative;
  min-height: 52px;
}
.nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(to right, var(--accent-dim), transparent 38%);
  opacity: 0.45;
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: stretch;
  line-height: 1;
}
.brand-mark {
  font-family: "Bebas Neue", "IBM Plex Sans", sans-serif;
    font-size: 35px;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #f5f6f9;
    padding: 4px 19px;
}
.brand:hover .brand-mark { background: var(--accent-dim); color: var(--strong); }
.brand-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(13, 14, 16, 0.42);
}
.brand:hover .brand-divider { background: rgba(255, 255, 255, 0.35); }
.brand-beta {
  align-self: center;
  margin-left: -6px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 2px 8px 1px;
  border-radius: 999px;
}

.nav-cluster {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding-right: 26px;
  align-self: center;
}
.nav-user {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.nav-sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--hair);
}
.nav-link {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
.nav-link:hover { color: var(--strong); }
.nav-link--accent { color: var(--accent); }
.nav-link--accent:hover { color: var(--strong); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px;
}

.auth { max-width: 360px; }
.auth h1 { font-size: 22px; font-weight: 600; letter-spacing: var(--tight); margin: 0 0 14px; color: var(--strong); }
.auth label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
.auth label input { display: block; margin-top: 4px; color: var(--text); }
.auth input, .auth textarea { width: 100%; }
.auth .magic {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 12px;
  word-break: break-all;
  color: var(--accent);
  white-space: break-spaces;
  font-size: 12px;
}

main:has(> .layout) {
  max-width: 1320px;
  padding-left: 32px;
  padding-right: 32px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 44px;
  align-items: start;
}
.layout-main { min-width: 0; }
.layout-side {
  border-left: 1px solid var(--hair);
  padding: 4px 0 4px 20px;
  position: sticky;
  top: 16px;
}
.side-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
}
.side-channels { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.side-channel a {
  display: block;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  color: var(--text);
}
.side-channel a:hover { background: var(--panel); }
.side-channel.active a {
  border-left-color: var(--accent);
  background: var(--panel);
}
.side-channel.active .side-channel-name { color: var(--accent); }
.side-channel-name { font-size: 14px; font-weight: 500; letter-spacing: var(--tight); color: var(--strong); }
.side-channel-meta { color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.home-welcome { padding: 6px 0; }
.home-welcome .home-title {
  font-family: "Bebas Neue", "IBM Plex Sans", sans-serif;
  font-size: 44px;
  letter-spacing: 0.04em;
  margin: 18px 0 4px;
  color: var(--strong);
}

@media (max-width: 640px) {
  .nav { gap: 8px; min-height: 44px; }
  .brand-mark {
    font-size: 20px;
    padding: 0 14px;
    letter-spacing: 0.04em;
  }
  .nav-cluster { gap: 10px; padding-right: 12px; }
  .nav-user, .nav-sep { display: none; }
  .nav-link { font-size: 10px; letter-spacing: 0.1em; }

  main:has(> .layout) { padding-left: 0; padding-right: 0; }
  .layout-main { padding: 0 16px; }
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .layout-side {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0;
    padding: 0;
    border-left: none;
    border-bottom: 1px solid var(--hair);
    background: var(--bg-elev);
  }
  .side-head { display: none; }
  .side-channels {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
    gap: 6px;
    scrollbar-width: thin;
  }
  .side-channels::-webkit-scrollbar { height: 4px; }
  .side-channel { flex: none; }
  .side-channel a {
    padding: 6px 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    background: transparent;
  }
  .side-channel a:hover { background: var(--panel); }
  .side-channel.active a {
    border-bottom-color: var(--accent);
    background: transparent;
  }
  .side-channel-meta { display: none; }
  .side-channel-name { font-size: 13px; }
}

.forum-head { margin-bottom: 18px; }
.forum-head h1 { font-size: 22px; font-weight: 600; letter-spacing: var(--tight); margin: 0 0 4px; color: var(--strong); }

.compose-bar {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-left: 2px solid var(--border);
  padding: 12px 14px;
  background: var(--panel);
}
.compose-bar:focus-within { border-left-color: var(--accent); }
.compose-title { width: 100%; border: none; background: transparent; padding: 4px 0; color: var(--text); }
.compose-title:focus { outline: none; }
.compose-rest { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.compose-rest textarea { width: 100%; }

.beta-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
}
.beta-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  padding: 2px 6px;
  background: var(--accent);
  color: #0d0e10;
}

.channel-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--hair); }
.channel-row { border-bottom: 1px solid var(--hair); }
.channel-link { display: block; padding: 14px 0; }
.channel-name { color: var(--strong); font-size: 17px; font-weight: 500; letter-spacing: var(--tight); }
.channel-link:hover .channel-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.channel-desc { color: var(--text); font-size: 13.5px; margin-top: 3px; }
.channel-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.thread-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--hair); }
.thread { border-bottom: 1px solid var(--hair); }
.thread-row { display: flex; gap: 14px; padding: 14px 0; cursor: pointer; }

.thread-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}
.thread.open .thread-body { grid-template-rows: 1fr; }
.thread-body-inner {
  min-height: 0;
  overflow: hidden;
}
.thread.open .thread-body-inner { padding: 8px 0; }

.thread-avatar, .post-avatar { width: 40px; height: 40px; background: #2a2d31; overflow: hidden; flex: none; }
.post-avatar.small { width: 30px; height: 30px; }
.thread-avatar img, .post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.thread-author, .post-author { color: var(--muted); font-size: 12.5px; }
.thread-title {
  color: var(--strong);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: var(--tight);
}
.thread-row:hover .thread-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.thread.open .thread-title { color: var(--accent); }
.thread-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.discussion { padding: -5px 0 0; }
.post-head { display: flex; gap: 10px; align-items: center; }
.post-title { color: var(--strong); font-size: 19px; font-weight: 600; letter-spacing: var(--tight); margin: 10px 0; }
.post-body { white-space: pre-wrap; color: var(--text); }
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.post-body a:hover { color: var(--strong); }
.post-body blockquote {
  margin: 4px 0;
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--accent-dim);
  color: var(--muted);
}
.post-actions { margin-top: 10px; display: flex; gap: 18px; align-items: center; }

.reply-form-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
}
.reply-form-wrap.open { grid-template-rows: 1fr; }
.reply-form-wrap > .reply-form {
  min-height: 0;
  overflow: hidden;
  margin-top: 0;
}
.reply-form-wrap.open > .reply-form { margin-top: 10px; }
.reply-form { display: flex; flex-direction: column; gap: 8px; }
.reply-form textarea { width: 100%; }

.files-pick { display: flex; flex-direction: column; gap: 6px; }
.files-list { list-style: none; padding: 0; margin: 0; }
.files-list:empty { display: none; }
.files-item { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.files-name { color: var(--text); }
.files-remove {
  background: transparent; border: none; padding: 0;
  color: var(--muted); cursor: pointer;
}
.files-remove:hover { color: #ff7777; }

.children { margin-top: 8px; }
.reply {
  border-left: 2px solid var(--hair);
  padding: 10px 0 4px 14px;
  margin-top: 8px;
}
.reply:hover { border-left-color: var(--accent-dim); }

.continue {
  background: transparent;
  border: none;
  color: var(--accent);
  padding: 6px 0;
  font: inherit;
  cursor: pointer;
}
.continue:hover { color: var(--strong); }

.att-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
.att {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid transparent;
}
.att:hover { border-color: var(--accent-dim); background: rgba(160,107,255,0.08); }

.like {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
  font: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.like:hover { color: var(--accent); }
.like.liked { color: var(--accent); }
.like .like-count { margin-left: 2px; }

#lightbox[hidden] { display: none; }
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,9,11,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border: 1px solid var(--border);
}

.ok { color: #74c69d; }
.muted { color: var(--muted); }
.danger { color: #ff7777 !important; }
.danger:hover { color: #ff9a9a !important; }

.settings { max-width: 680px; margin: 32px auto 64px; padding: 0 22px; }
.settings-head { margin-bottom: 22px; }
.settings-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hair);
}
.card > p { margin: 0 0 14px; }
.card .status { margin: 0 0 6px; font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field input { width: 100%; }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.cancel-row { margin-top: 10px; }

input.otp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: 0.3em;
  max-width: 180px;
}

.kv {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--bg); border-left: 2px solid var(--accent-dim);
}
.kv + .kv { margin-top: 10px; }
.kv > span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--strong);
}
.mono.break { word-break: break-all; }

.totp-setup {
  display: flex;
  gap: 22px;
  margin: 16px 0 20px;
  align-items: flex-start;
}
.totp-fields { flex: 1; min-width: 0; }
.qr {
  flex: 0 0 220px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  line-height: 0;
}
.qr img { display: block; width: 220px; height: 220px; }
@media (max-width: 560px) {
  .totp-setup { flex-direction: column; }
  .qr { align-self: center; }
}

.pin-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 1px 5px;
  margin-right: 6px;
  vertical-align: 1px;
}
/* .thread.pinned { background: linear-gradient(to right, rgba(160,107,255,0.04), transparent 40%); } */

.danger-btn { color: #ff8888; border-color: #5a2c2c; }
.danger-btn:hover { color: #ffb0b0; border-color: #8a4040; }

.edit-form { display: flex; flex-direction: column; gap: 8px; }
.edit-title { font-weight: 600; font-size: 15px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
