/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #111111;
  --bg2: #1a1a1a;
  --bg3: #222222;
  --text: #e8e8e8;
  --text2: #888888;
  --text3: #555555;
  --border: #2a2a2a;
  --accent: #e05c2a;
  --accent-hover: #c94e1f;
  --danger: #cc3333;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  --bg: #f9f9f9;
  --bg2: #ffffff;
  --bg3: #f0f0f0;
  --text: #111111;
  --text2: #666666;
  --text3: #999999;
  --border: #e0e0e0;
  --accent: #e05c2a;
  --accent-hover: #c94e1f;
  --danger: #cc3333;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

/* Eliminate iOS 300ms tap delay on all interactive elements */
a, button, [role="button"], label, input, select, textarea { touch-action: manipulation; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  line-height: 1.5;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  line-height: 1.5;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text3); text-decoration: none; }

.btn-icon {
  background: transparent;
  color: var(--text2);
  border: none;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 8px;
}
.btn-icon:hover { color: var(--text); }

button { font-family: var(--font); }

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar-brand {
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand:hover { text-decoration: none; color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-size: 15px;
  color: var(--text2);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--accent); }
.nav-link-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  color: var(--text3) !important;
  pointer-events: auto !important;
}
.nav-link-disabled:hover { color: var(--text3) !important; }

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

#nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-logout {
  background: transparent;
  color: var(--text2);
  border: none;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
}
.btn-logout:hover { color: var(--text); }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

/* ── Communities dropdown ──────────────────────────────────────────────────── */
.community-wrap { position: relative; }

.btn-communities {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 15px;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.btn-communities:hover { color: var(--text); }

.community-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.community-dropdown.open { display: block; }

.community-item {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.community-item:last-child { border-bottom: none; }
.community-item:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.community-item.active { color: var(--accent); }

/* ── Online badge ──────────────────────────────────────────────────────────── */
.online-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: #3a3;
  border-radius: 50%;
  display: inline-block;
}

/* ── Bottom sheet (mobile) ─────────────────────────────────────────────────── */
/* ── Video beta modal ───────────────────────────────────────────────────── */
#video-beta-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
#video-beta-modal.open { display: flex; }
.vbm-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 360px;
  width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.vbm-msg {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 20px;
}
.vbm-close { width: 100%; }

.bottom-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: flex-end;
}
.bottom-sheet-overlay.open { display: flex; }

.bottom-sheet {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  width: 100%;
  padding: 8px 0 24px;
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 16px;
}

.bottom-sheet-link {
  display: block;
  padding: 12px 20px;
  font-size: 15px;
  color: var(--text2);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.bottom-sheet-link:last-child { border-bottom: none; }
.bottom-sheet-link.active { color: var(--accent); }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 0 16px 8px;
}

.sidebar-boards { display: flex; flex-direction: column; }

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text2);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: var(--bg3); color: var(--accent); }

/* Extra nav links injected into the sidebar for mobile — hidden on desktop */
.sidebar-extra-nav { display: none; }
@media (max-width: 768px) {
  .sidebar-extra-nav { display: block; }
}

/* Communities button in sidebar — reset <button> defaults, inherit sidebar-link style */
.sidebar-communities-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
}

.sidebar-badge {
  display: none;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Sidebar user search ──────────────────────────────────────────────────── */
.sidebar-search { position: relative; margin: 12px 16px 0; }

.sidebar-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  font-size: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  outline: none;
}
.sidebar-search-input:focus { border-color: var(--accent); }
.sidebar-search-input::placeholder { color: var(--text3); }

.sidebar-search-results {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.sidebar-search-results.open { display: block; }

.sidebar-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sidebar-search-item:last-child { border-bottom: none; }
.sidebar-search-item:hover { background: var(--bg3); color: var(--accent); text-decoration: none; }

.sidebar-search-empty { padding: 8px 10px; font-size: 12px; color: var(--text3); }

/* ── Language switcher ───────────────────────────────────────────────────── */
.lang-switcher { margin: 12px 16px 8px; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-size: 12px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.lang-globe { font-size: 13px; flex-shrink: 0; }
.lang-btn-label { flex: 1; text-align: left; }
.lang-btn-arrow { font-size: 10px; color: var(--text3); flex-shrink: 0; }
.lang-current-name {
  font-size: 11px; color: var(--text3); padding: 2px 10px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lang-dropdown {
  /* position: fixed — set by JS to bypass sidebar overflow-y:auto */
  display: none; position: fixed;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  overflow-y: auto;                   /* scrollable — was: overflow:hidden */
  -webkit-overflow-scrolling: touch;  /* momentum scroll on iOS */
  overscroll-behavior: contain;       /* don't let scroll propagate to page */
  z-index: 1000; box-shadow: 0 6px 24px rgba(0,0,0,0.22);
  min-width: 160px;
  /* max-height is set dynamically by JS to fit within the viewport */
}
.lang-dropdown.open { display: block; }
.lang-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px; background: none; border: none;
  color: var(--text2); font-size: 13px; cursor: pointer; text-align: left;
  transition: background 0.12s;
}
.lang-option:hover { background: var(--bg3); color: var(--text); }
.lang-option.active { color: var(--accent); background: var(--bg3); }
.lang-option-code { font-weight: 700; min-width: 26px; font-size: 11px; color: var(--text3); }
.lang-option.active .lang-option-code { color: var(--accent); }
.lang-option-name { flex: 1; }

.main-content {
  flex: 1;
  padding: 24px;
  max-width: 780px;
  min-width: 0;
}

.right-col {
  width: 260px;
  flex-shrink: 0;
  padding: 32px 20px;

  background: var(--bg);
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
}

@media (max-width: 1280px) {
  .right-col { display: none; }
}

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 600;
}

/* ── Back button ───────────────────────────────────────────────────────────── */
.back-btn {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 12px;
}
.back-btn:hover { text-decoration: underline; }

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.breadcrumb a { color: var(--text3); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb-sep { color: var(--text3); }

/* ── Thread list ───────────────────────────────────────────────────────────── */
.thread-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  border-left: 3px solid transparent;
  transition: border-left-color .1s;
}
.thread-card:not(.thread-read) { border-left-color: var(--accent); }

.thread-card-body {
  display: block;
  padding: 18px 22px;
  color: var(--text);
  text-decoration: none;
}
.thread-card-body:hover { background: var(--bg3); text-decoration: none; color: var(--text); }

.thread-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.thread-card-preview {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 6px;
  line-height: 1.5;
  word-break: break-word;
}
.see-more {
  color: var(--accent);
  font-size: 12px;
}

.thread-card-meta {
  font-size: 13px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 22px 10px;
}

/* Profile link — wraps avatar + username in thread/post cards */
.pseudo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  border-radius: 3px;
}
.pseudo-link:hover { text-decoration: none; }
.pseudo-link:hover .pseudo { color: var(--accent); }

.thread-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.btn-expand-replies {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--font);
}
.btn-expand-replies:hover { color: var(--accent); }

.thread-card.thread-read .thread-card-title,
.thread-title-read {
  font-weight: 700;
  color: var(--text2);
}

.thread-title, .thread-card .title, .thread-card h2, .thread-card h3,
.thread-card-title {
  font-weight: 700 !important;
  font-size: 18px !important;
  color: var(--text) !important;
}
.thread-card.thread-read .thread-card-title,
.thread-title-read {
  color: var(--text2) !important;
}

.btn-like, .btn-save, .btn-share {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  padding: 6px 12px;
  border-radius: 3px;
}
.btn-like:hover, .btn-save:hover, .btn-share:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-like.liked, .btn-save.saved {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@keyframes like-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.like-pop { animation: like-pop 200ms ease-out; }

.btn-delete-thread {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--danger);
  cursor: pointer;
  font-family: var(--font);
  padding: 2px 6px;
}
.btn-delete-thread:hover { opacity: 0.8; }

.inline-replies {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 14px;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.pseudo { color: var(--text2); font-size: 13px; }
.pseudo-handle { color: var(--text3); font-size: 11px; margin-left: 2px; }
.board-badge {
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text3);
  cursor: pointer;
}
.board-badge:hover { color: var(--accent); border-color: var(--accent); }
.thread-reply-count { color: var(--text3); }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge-new {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
}

.badge-op {
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Post cards ────────────────────────────────────────────────────────────── */
.posts-list { margin-bottom: 24px; }

.post-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  padding: 12px 16px;
  transition: border-color 0.3s;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.post-card.own { border-color: var(--text3); }
.post-card.post-highlighted { border-color: var(--accent); }
.post-card.post-is-op {
  background: var(--bg3);
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
}

.post-parent-ref {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 6px;
}
.post-parent-ref a { color: var(--text3); text-decoration: underline; }
.post-parent-ref a:hover { color: var(--text2); }

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.post-content {
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}
.post-content code {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 13px;
  white-space: normal;
}
.post-content strong { font-weight: 600; }
.post-content em { font-style: italic; }

.post-delete, .post-report, .post-reply, .post-copy-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  padding: 2px 5px;
  border-radius: 3px;
}
.post-delete { color: var(--danger); margin-left: auto; }
.post-delete:hover { opacity: 0.7; }
.post-report { color: var(--text3); }
.post-report:hover { color: var(--text2); }
.post-reply { color: var(--accent); border: 1px solid var(--border); }
.post-reply:hover { border-color: var(--accent); }
.post-copy-link { color: var(--text3); border: 1px solid var(--border); }
.post-copy-link:hover { color: var(--text2); border-color: var(--text3); }

/* ── Nested replies (Twitter-style threading) ────────────────────────────── */
.post-wrap { position: relative; }

.replies-panel {
  border-left: 2px solid var(--border);
  margin-left: 12px;
  padding: 0 0 0 12px;
  margin-top: 2px;
}
.replies-panel-deep { margin-left: 0; }

@keyframes panelSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-open { animation: panelSlide 0.18s ease; }

.replies-toggle {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  padding: 3px 0;
  margin: 1px 0;
  display: block;
  line-height: 1.4;
}
.replies-toggle:hover { text-decoration: underline; }

.inline-reply-form {
  margin: 6px 0 4px 0;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.inline-reply-form .irf-ta {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 16px;
  resize: vertical;
  min-height: 62px;
  outline: none;
}
.inline-reply-form .irf-ta:focus { border-color: var(--accent); }
.irf-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── Avatar change overlay ───────────────────────────────────────────────── */
.avatar-change-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.avatar-change-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}
.avatar-change-wrap:hover .avatar-change-overlay { opacity: 1; }

/* ── Thread header / OP card ───────────────────────────────────────────────── */
.thread-header { margin-bottom: 20px; }

.op-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.op-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 10px;
  line-height: 1.3;
}

.op-content {
  margin-bottom: 10px;
}

.op-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text3);
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Reply form ────────────────────────────────────────────────────────────── */
.reply-form {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 8px;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
}

input, textarea, select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 16px;
  font-family: var(--font);
  width: 100%;
  display: block;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  outline: none;
}
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }

.error-msg {
  font-size: 13px;
  color: var(--danger);
  margin-top: 6px;
  display: none;
}
.error-msg.show { display: block; }

.success-msg {
  font-size: 13px;
  color: #4a4;
  margin-top: 6px;
  display: none;
}
.success-msg.show { display: block; }

/* ── Char counter & preview ────────────────────────────────────────────────── */
.char-counter { font-size: 11px; color: var(--text3); }
.char-counter.over { color: var(--danger); }

.format-hint { font-size: 11px; color: var(--text3); }
.format-hint code {
  background: var(--bg3);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 11px;
  color: var(--text2);
}

.preview-bar {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.preview-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.65;
  min-height: 80px;
  word-break: break-word;
}

/* ── Account & auth ────────────────────────────────────────────────────────── */
.account-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  margin-bottom: 16px;
}

.tab-btns {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); }

.key-warning {
  background: rgba(224,92,42,0.1);
  border: 1px solid rgba(224,92,42,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
}

.key-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--text);
  margin-bottom: 10px;
  user-select: all;
}

/* ── Ideas page ────────────────────────────────────────────────────────────── */
.idea-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.idea-votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 52px;
}

.vote-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  width: 100%;
  text-align: center;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.active { border-color: var(--accent); color: var(--accent); }

.idea-score {
  font-size: 11px;
  color: var(--text3);
}

.idea-body { flex: 1; min-width: 0; }

.idea-content {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 6px;
}

.idea-meta { font-size: 11px; color: var(--text3); }

/* ── Admin page ────────────────────────────────────────────────────────────── */
.admin-section { margin-bottom: 32px; }
.admin-section h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.report-card-meta {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.report-card-content {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
  word-break: break-word;
}
.report-card-reason { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
}
.btn-danger:hover { opacity: 0.85; }

/* ── Admin user list ─────────────────────────────────────────────────── */
.user-admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.user-admin-row:last-child { border-bottom: none; }
.user-admin-row:hover { background: var(--bg3); }
.admin-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.admin-badge.active { background: rgba(34,197,94,.15); color: #22c55e; }
.admin-badge.banned { background: rgba(204,51,51,.15);  color: var(--danger); }
.admin-users-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  margin-bottom: 12px;
}
.admin-users-search:focus { border-color: var(--accent); }
.admin-users-list {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Profile page ──────────────────────────────────────────────────────────── */
.profile-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

/* ── Profile name row ─────────────────────────────────────────────────── */
.profile-name-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-admin-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  vertical-align: middle;
  flex-shrink: 0;
}
.profile-display-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.profile-handle {
  font-size: 16px;
  color: var(--text3);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.profile-member-since {
  font-size: 12px;
  margin: 4px 0 0;
}

.profile-stats {
  display: flex;
  gap: 24px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.stat { text-align: center; }
.stat-val { font-size: 20px; font-weight: 600; color: var(--text); display: block; }
.stat-lbl { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }

.profile-section { margin-bottom: 24px; }
.profile-section h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: 13px;
}
.profile-item a { color: var(--text); }
.profile-item a:hover { color: var(--accent); }
.profile-item-meta { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── Reading mode ──────────────────────────────────────────────────────────── */
.reading-exit {
  display: none;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 500;
}

.reading-mode .navbar,
.reading-mode .sidebar,
.reading-mode .reply-form,
.reading-mode #login-prompt {
  display: none !important;
}

.reading-mode .reading-exit { display: block; }
.reading-mode .layout { display: block; }

.reading-mode .main-content {
  max-width: 680px;
  margin: 32px auto;
  padding: 0 24px 60px;
}

/* ── Scroll to top ─────────────────────────────────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  z-index: 50;
  transition: color 0.15s, border-color 0.15s;
}
.scroll-top-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text2); }
.time { color: var(--text3); font-size: 12px; }

.empty-state {
  text-align: center;
  color: var(--text2);
  padding: 40px 0;
  font-size: 14px;
}
.empty-state a { color: var(--accent); }

.scroll-sentinel { height: 1px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 12px; gap: 8px; }
  .nav-links { display: none; }
  .hamburger { display: block; }
  .online-badge { display: none; }

  /* Prevent navbar-right from overflowing the screen */
  .navbar-right { gap: 6px; min-width: 0; flex-shrink: 1; overflow: visible; }
  #nav-auth     { gap: 6px; min-width: 0; flex-shrink: 1; }

  /* Hide the message / notification icon links on mobile (in hamburger menu) */
  .nav-msg-link, .nav-notif-link { display: none; }

  /* Hide desktop-only nav items on mobile */
  .nav-desktop-only { display: none !important; }

  /* Show avatar-dropdown menu on mobile */
  .nav-mobile-menu {
    display: flex;
    align-items: center;
    position: relative;
  }
  .nav-mobile-avatar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    line-height: 0;
  }
  .nav-mobile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 160px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    z-index: 200;
    flex-direction: column;
    padding: 4px 0;
  }
  .nav-mobile-dropdown.open { display: flex; }
  .nav-mobile-pseudo {
    padding: 10px 16px 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }
  .nav-mobile-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text2);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    text-align: left;
    box-sizing: border-box;
  }
  .nav-mobile-item:hover,
  .nav-mobile-item:focus { color: var(--text); background: var(--bg3); outline: none; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 52px;
    height: calc(100vh - 52px);
    z-index: 150;
    transform: translateX(-220px);
    transition: transform 0.1s ease;
    width: 200px;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { padding: 16px; }
  .account-card { padding: 16px; }
  .idea-card { flex-direction: column; gap: 10px; }
  .idea-votes { flex-direction: row; min-width: auto; }

  .profile-name-row {
    display: block;
  }
  .profile-display-name {
    font-size: 40px;
  }
  .profile-handle {
    display: block;
    font-size: 18px;
    margin-top: 2px;
  }
}

@media (max-width: 480px) {
  .thread-card-meta { flex-wrap: wrap; }
  .post-header { flex-wrap: wrap; }
  .profile-stats { gap: 16px; }
}

/* ── Image attach UI ───────────────────────────────────────────────────────── */
.attach-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.attach-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.attach-remove:hover { background: var(--danger); }

/* ── Post images & media embeds ────────────────────────────────────────────── */
.post-images {
  width: 100%;
  overflow: hidden;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-image-container {
  width: 100%;
  overflow: hidden;
  max-height: 400px;
  border-radius: 8px;
  display: block;
  position: relative;
}

.post-image-container img,
.post-img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

/* Global safety-net — :not(.avatar) preserves avatar layout */
.thread-card img:not(.avatar),
.post-card img:not(.avatar),
.inline-replies img:not(.avatar),
.post-wrap img:not(.avatar) {
  max-width: 100%;
  max-height: 400px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}
.post-media {
  margin-top: 8px;
}
.post-media iframe,
.post-media video {
  display: block;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16/9;
  border: none;
  border-radius: var(--radius);
  background: #000;
}

/* ── Avatar ─────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.avatar-fallback {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}
.nav-avatar-link {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile avatar menu — hidden on desktop, shown on mobile via media query */
@media (min-width: 769px) { .nav-mobile-menu { display: none; } }
.post-header .avatar,
.post-header .avatar-fallback {
  margin-right: 2px;
}

/* ── Pinned thread ───────────────────────────────────────────────────── */
.pinned-thread {
  border-left: 3px solid var(--accent);
}
.pinned-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0 0 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-sizing: border-box;
}
.pinned-expand-row {
  padding: 0 22px 10px 22px;
  box-sizing: border-box;
}
.pinned-read-more {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}
.pinned-read-more:hover {
  text-decoration: underline;
}
.pinned-full-content {
  font-size: 15px;
  color: var(--text2);
  margin-top: 8px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.pinned-thread .thread-card-title {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.pinned-thread .pseudo {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.pinned-thread .thread-card-footer {
  padding-left: 22px;
}
.btn-pin-thread {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-pin-thread:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Search ──────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-right: 6px;
}
.search-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 16px;
  width: 160px;
  outline: none;
  transition: border-color .15s, width .2s;
}
.search-input:focus {
  border-color: var(--accent);
  width: 220px;
}
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
}
.search-dropdown.open { display: block; }
.search-item {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg3); }
.search-item-title { font-size: 13px; color: var(--text); }
.search-item-meta  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.search-empty { padding: 10px 12px; font-size: 13px; color: var(--text3); }
@media (max-width: 600px) {
  .search-input { width: 100px; }
  .search-input:focus { width: 140px; }
  .search-dropdown { min-width: 240px; }
}

/* ── @mention ────────────────────────────────────────────────────────── */
.mention {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.mention:hover { text-decoration: underline; }
.mention-dropdown {
  display: none;
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 300;
  min-width: 160px;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
}
.mention-dropdown.open { display: block; }
.mention-item {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.mention-item:last-child { border-bottom: none; }
.mention-item:hover { background: var(--bg3); color: var(--accent); }

/* ── Like tooltip ────────────────────────────────────────────────────── */
.like-tooltip {
  display: none;
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text2);
  max-width: 240px;
  white-space: normal;
  word-break: break-word;
  z-index: 400;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ── New post flash animation ────────────────────────────────────────── */
@keyframes postFlash {
  from { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  to   { background: transparent; }
}
.post-new {
  animation: postFlash 1.2s ease-out forwards;
}

/* ── Admin stats ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.stat-card-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.stat-card-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  display: block;
}
.stat-card-sub {
  font-size: 11px;
  color: var(--accent);
  display: block;
  margin-top: 2px;
}

/* ── Toast notifications ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text);
  z-index: 9000;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-left: 3px solid #2ecc71; }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }

/* ── Skeleton loading ────────────────────────────────────────────────── */
.skeleton-card { pointer-events: none; padding: 14px 16px !important; }
.skeleton-line {
  border-radius: 4px;
  background: var(--bg2);
  animation: skeletonPulse 1.2s ease-in-out infinite;
  display: block;
}
@keyframes skeletonPulse {
  0%, 100% { background: var(--bg2); }
  50%       { background: var(--bg3); }
}

/* ── Notification badge ──────────────────────────────────────────────── */
.nav-notif-link {
  position: relative;
  font-size: 13px;
  color: var(--text2);
}
.nav-notif-link:hover { color: var(--accent); }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  box-sizing: border-box;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Read thread state ───────────────────────────────────────────────── */
.thread-title-read { color: var(--text3); }
.badge-updated {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 4px;
  vertical-align: middle;
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Edit / inline delete ────────────────────────────────────────────── */
.post-edit-area {
  margin-top: 8px;
}
.post-edit-area textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  resize: vertical;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px;
  font-family: var(--font);
  font-size: 16px;
}
.post-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.post-edited {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-style: italic;
}
.inline-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}
.inline-confirm button {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text);
}
.inline-confirm .btn-yes { color: var(--danger); border-color: var(--danger); }
.inline-confirm .btn-yes:hover { background: var(--danger); color: #fff; }
.post-deleted { opacity: 0.55; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.site-footer a { color: var(--text3); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── Sort / mode bar ─────────────────────────────────────────────────── */
.feed-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.feed-tab {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.feed-tab.active, .feed-tab:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.feed-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

/* ── Welcome empty state ─────────────────────────────────────────────── */
.welcome-state {
  text-align: center;
  padding: 48px 24px;
}
.welcome-state h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.welcome-state p {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 6px;
  line-height: 1.6;
}
.welcome-state .welcome-policy {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 20px;
}
.welcome-state .welcome-policy a { color: var(--text3); text-decoration: underline; }

/* ── Notifications page ──────────────────────────────────────────────── */
.notif-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  position: relative;
}
.notif-row:hover { background: var(--bg2); }
.notif-row.unread { border-left: 3px solid var(--accent); background: var(--bg3); }
.notif-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 12px 16px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.notif-row.unread .notif-link { padding-left: 13px; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; line-height: 1.45; color: var(--text); word-break: break-word; }
.notif-text strong { font-weight: 600; }
.notif-time-small { font-size: 12px; color: var(--text3); margin-top: 2px; display: block; }
.notif-thumb { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.notif-follow-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0 8px;
}
.notif-follow-btn:hover { background: var(--accent-hover); }
.notif-follow-btn.following {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  cursor: default;
}
.notif-delete-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  padding: 0 14px;
  align-self: stretch;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.notif-delete-btn:hover { color: var(--danger); }

/* ── About page ──────────────────────────────────────────────────────── */
.about-content {
  max-width: 680px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text2);
}
.about-content h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}
.about-content h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 12px;
}
.about-content p { margin-bottom: 16px; }
.about-content a { color: var(--accent); text-decoration: none; }
.about-content a:hover { text-decoration: underline; }

/* ── Rules page ──────────────────────────────────────────────────────── */
.rules-list {
  list-style: none;
  padding: 0;
  counter-reset: rule-counter;
}
.rule-item {
  counter-increment: rule-counter;
  padding: 10px 12px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.rule-item:hover {
  border-left-color: var(--accent);
  background: var(--bg2);
}
.rule-item::before {
  content: counter(rule-counter) ".";
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 20px;
}
.rule-critical {
  font-size: 10px;
  font-weight: 700;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  align-self: center;
}
.rules-footer-note {
  margin-top: 24px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text3);
  line-height: 1.6;
}

/* ── Search user card ────────────────────────────────────────────────── */
.search-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s;
}
.search-user-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}

/* ── Follow button ───────────────────────────────────────────────────── */
.btn-follow {
  padding: 5px 14px;
  font-size: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s, color .15s;
}
.btn-follow:hover { background: var(--accent); color: #fff; }
.btn-follow.following {
  background: var(--accent);
  color: #fff;
}
.btn-follow.following:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── Bio display ─────────────────────────────────────────────────────── */
.bio-display {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  margin-top: 6px;
  cursor: pointer;
  padding: 4px 0;
}
.bio-display.no-bio { color: var(--text3); font-style: italic; }
.bio-edit-area { margin-top: 6px; }
.bio-edit-area textarea {
  width: 100%;
  max-width: 400px;
  padding: 6px 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  resize: none;
}
.bio-counter { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── RTL support (Arabic) ────────────────────────────────────────────────── */
html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .navbar-brand { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .nav-mobile-dropdown { right: auto; left: 0; }
html[dir="rtl"] .nav-mobile-item { text-align: right; }
html[dir="rtl"] .post-parent-ref { direction: rtl; }
html[dir="rtl"] .lang-dropdown { left: auto; right: 0; }

/* ── Cross-document View Transitions (Chrome 126+, Safari 18.2+) ────────────
   Degrades gracefully: unsupported browsers just navigate normally.        */
@view-transition {
  navigation: auto;
}

@keyframes _vt-out { to   { opacity: 0; } }
@keyframes _vt-in  { from { opacity: 0; } }

::view-transition-old(root) {
  animation: 100ms ease-out both _vt-out;
}
::view-transition-new(root) {
  animation: 200ms ease-in  both _vt-in;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

