@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-body: #13141a;
  --bg-surface: rgba(21,22,30,.88);
  --bg-surface-raised: rgba(27,28,38,.92);
  --bg-header: rgba(16,17,23,.95);
  --bg-input: rgba(17,18,26,.85);
  --bg-hover: rgba(255,255,255,.035);
  --border: rgba(255,255,255,.06);
  --border-active: rgba(239,68,68,.3);
  --glass-border: rgba(255,255,255,.05);
  --glass-shine: rgba(255,255,255,.025);
  --text: #e4e4e9;
  --text-dim: #9d9daa;
  --text-faint: #656575;
  --accent: #c53030;
  --accent-light: #ef4444;
  --accent-glow: rgba(239,68,68,.12);
  --green: #22c55e;
  --green-bright: #4ade80;
  --gold: #eab308;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --blur: blur(16px);
  --shadow: 0 2px 16px rgba(0,0,0,.25), 0 0 0 1px var(--glass-border);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px var(--glass-border);
}

/* === PAGE TRANSITIONS === */
#app { transition: opacity .15s ease, transform .15s ease; }
#app.page-exit { opacity: 0; transform: translateY(4px); }
#app.page-enter { opacity: 0; transform: translateY(-4px); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(160,30,30,.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 100% 100%, rgba(100,20,20,.04) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; transition: color .15s; }
img { max-width: 100%; display: block; }
button, a, input, textarea, select { transition: all .2s ease; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }

/* === ICON === */
.icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex-shrink: 0; line-height: 0; }
.icon svg { width: 100%; height: 100%; }

/* === LAYOUT === */
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.page-wrapper { display: flex; gap: 16px; padding: 16px 0 40px; }
.content-area { flex: 1; min-width: 0; }
.sidebar { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }

/* === NAVBAR === */
.navbar {
  background: var(--bg-header);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.navbar .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
}
.navbar-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-right: 24px;
  white-space: nowrap;
  letter-spacing: -.03em;
  text-shadow: 0 0 16px rgba(239,68,68,.2);
}
.navbar-logo:hover { color: #ff6b6b; text-shadow: 0 0 20px rgba(239,68,68,.3); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}
.nav-links a {
  color: var(--text-dim);
  font-size: .85rem;
  font-weight: 500;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: #fff; border-bottom-color: var(--accent-light); }
.nav-links a.nav-purchase { color: var(--green-bright); }
.nav-links a.nav-purchase:hover { color: #5dff8a; }
.nav-links a .icon { margin-left: 2px; opacity: .4; }
.nav-spacer { flex: 1; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}
.nav-icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.nav-icon-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }
.badge-count {
  position: absolute;
  top: 2px;
  right: 1px;
  background: var(--accent-light);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 6px;
  min-width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 6px rgba(239,68,68,.35);
}
.nav-search-link {
  color: var(--text-dim);
  font-size: .85rem;
  font-weight: 500;
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  transition: color .15s;
}
.nav-search-link:hover { color: var(--text); }
.nav-user {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  position: relative;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  margin-left: 4px;
}
.nav-user:hover { background: rgba(255,255,255,.05); }
.nav-user-name { color: var(--text); font-size: .85rem; font-weight: 500; }

/* === USER DROPDOWN === */
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface-raised);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 260px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1001;
}
.user-dropdown.open { display: block; }
.dropdown-header {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}
.dropdown-info { flex: 1; min-width: 0; }
.dropdown-username { font-weight: 600; font-size: .9rem; }
.dropdown-role { font-size: .75rem; color: var(--text-faint); margin-top: 1px; }
.dropdown-stats { display: flex; gap: 10px; font-size: .72rem; color: var(--text-dim); margin-top: 4px; }
.dropdown-links { padding: 6px 0; }
.dropdown-links a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: .85rem;
  transition: background .12s, color .12s;
  border-radius: 0;
}
.dropdown-links a:hover { background: var(--bg-hover); color: var(--text); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  font-size: .85rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-active); color: #fff; box-shadow: 0 0 12px rgba(239,68,68,.08); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #991b1b 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(185,28,28,.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%); box-shadow: 0 4px 20px rgba(239,68,68,.4); }
.btn-danger { background: rgba(127,29,29,.4); border-color: rgba(239,68,68,.2); color: #fca5a5; }
.btn-danger:hover { background: rgba(153,27,27,.5); box-shadow: 0 0 12px rgba(239,68,68,.15); }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }

/* === FORMS === */
.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 5px; color: var(--text-dim); font-size: .85rem; font-weight: 500; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(239,68,68,.1), 0 0 12px rgba(239,68,68,.08); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-error { color: var(--accent-light); font-size: .8rem; margin-top: 4px; }
.form-hint { color: var(--text-faint); font-size: .78rem; margin-top: 3px; }

/* === CARDS (glass) === */
.card {
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  background: var(--glass-shine);
}
.card-body { padding: 12px 16px; }

/* === AUTH === */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { color: var(--accent-light); font-size: 1.5rem; font-weight: 700; text-shadow: 0 0 20px rgba(239,68,68,.3); }
.auth-logo p { color: var(--text-faint); font-size: .85rem; margin-top: 6px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: .85rem; color: var(--text-dim); }
.auth-footer a { color: var(--accent-light); }
.auth-footer a:hover { text-shadow: 0 0 8px rgba(239,68,68,.3); }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .85rem; }
.alert-error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.15); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.15); color: #86efac; }

/* === SHOUTBOX === */
.shoutbox {
  border-left: 3px solid var(--accent);
}
.shoutbox .card-header {
  background: var(--bg-surface-raised);
}
.sb-controls {
  display: flex;
  gap: 2px;
}
.sb-controls button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: color .15s, background .15s;
}
.sb-controls button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.shoutbox-messages {
  height: 260px;
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.shoutbox-msg {
  display: flex;
  align-items: baseline;
  gap: 0;
  font-size: .84rem;
  line-height: 1.5;
  padding: 2px 0;
  position: relative;
}
.shoutbox-msg .sb-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 5px;
  align-self: flex-start;
  margin-top: 2px;
}
.shoutbox-msg .sb-prefix {
  color: var(--text-faint);
  margin-right: 2px;
  font-weight: 600;
}
.shoutbox-msg .sb-user { font-weight: 600; white-space: nowrap; }
.shoutbox-msg .sb-sep { color: var(--text-faint); margin: 0 4px; }
.shoutbox-msg .sb-content { word-break: break-word; color: var(--text-dim); flex: 1; }
.shoutbox-msg .sb-time { color: var(--text-faint); font-size: .7rem; white-space: nowrap; margin-left: 8px; }
.shoutbox-msg .sb-delete {
  display: none;
  background: none;
  border: none;
  color: var(--accent-light);
  cursor: pointer;
  padding: 0 4px;
  margin-left: 2px;
  line-height: 0;
}
.shoutbox-msg:hover .sb-delete { display: inline-flex; }
.shoutbox-input {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.shoutbox-input input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .84rem;
  transition: border-color .2s, box-shadow .2s;
}
.shoutbox-input input:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(239,68,68,.08); }
.shoutbox-input .sb-toolbar {
  display: flex;
  gap: 2px;
}
.shoutbox-input .sb-toolbar button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: color .15s, background .15s;
}
.shoutbox-input .sb-toolbar button:hover { color: var(--accent-light); background: rgba(239,68,68,.06); }

/* === CATEGORY LIST === */
.category-section-title {
  padding: 10px 16px;
  background: var(--bg-surface-raised);
  backdrop-filter: var(--blur);
  font-weight: 700;
  font-size: .92rem;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text);
  text-transform: lowercase;
  border-left: 3px solid var(--accent);
}
.category-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  transition: all .15s;
}
.category-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.category-row:hover { background: var(--bg-hover); border-color: var(--border-active); }
.cat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
  background: rgba(239,68,68,.06);
  border-radius: var(--radius-sm);
  opacity: .7;
}
.cat-info { flex: 1; min-width: 0; }
.cat-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  display: block;
}
.cat-name:hover { color: #fff; }
.cat-stats {
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: 2px;
}
.cat-stats b { color: var(--text-dim); font-weight: 600; }
.cat-latest {
  width: 260px;
  flex-shrink: 0;
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: flex-end;
}
.cat-latest-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.cat-latest-info { min-width: 0; text-align: right; }
.cat-latest-title {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
  display: block;
}
.cat-latest-title:hover { color: #ddd; }
.cat-latest-meta { color: var(--text-faint); font-size: .72rem; margin-top: 1px; }

/* === THREAD LIST === */
.thread-list-header {
  display: flex;
  padding: 8px 16px;
  background: var(--bg-surface-raised);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: .78rem;
  color: var(--text-faint);
  font-weight: 600;
}
.thread-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  transition: all .15s;
}
.thread-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.thread-row:hover { background: var(--bg-hover); }
.thread-row.pinned { border-left: 2px solid var(--gold); }
.thread-icon { color: var(--text-faint); width: 20px; flex-shrink: 0; display: flex; justify-content: center; }
.thread-title-area { flex: 1; min-width: 0; }
.thread-title {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.thread-title:hover { color: #fff; }
.thread-author { font-size: .76rem; color: var(--text-faint); margin-top: 2px; }
.thread-stats { display: flex; gap: 20px; font-size: .78rem; text-align: center; color: var(--text-faint); flex-shrink: 0; }
.thread-stats .stat-value { color: var(--text-dim); font-weight: 600; display: block; }
.thread-last-reply { width: 170px; flex-shrink: 0; font-size: .78rem; text-align: right; }
.thread-last-reply .lr-user { color: var(--text-dim); }
.thread-last-reply .lr-time { color: var(--text-faint); }

/* === BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-size: .82rem;
  color: var(--text-faint);
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent-light); }
.breadcrumb-sep { color: var(--text-faint); font-size: .7rem; }

/* === POST CARD === */
.post-list { display: flex; flex-direction: column; }
.post-card {
  display: flex;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
}
.post-card:first-child { border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.post-card:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.post-author {
  width: 170px;
  flex-shrink: 0;
  padding: 16px;
  border-right: 1px solid var(--border);
  text-align: center;
  background: var(--glass-shine);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background .2s, border-color .2s;
}
.post-card:hover .post-author { background: rgba(255,255,255,.015); }
.post-author-avatar {
  margin: 0 auto 6px;
  border: 2px solid rgba(255,255,255,.06) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  transition: border-color .2s, box-shadow .2s;
}
.post-card:hover .post-author-avatar { border-color: rgba(239,68,68,.2) !important; box-shadow: 0 2px 14px rgba(239,68,68,.08); }
.post-author-name { font-weight: 600; font-size: .92rem; display: block; margin-bottom: 2px; }
.post-author-role {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 4px;
}
.post-author-status {
  font-size: .72rem;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Role badge styles (.role-*) are now dynamically injected via JavaScript */
.post-author-badges { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 4px; width: 100%; }
.user-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.post-author-stats {
  font-size: .7rem;
  color: var(--text-faint);
  line-height: 1.8;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  width: 100%;
}
.post-content-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-faint);
}
.post-header-right { display: flex; gap: 8px; align-items: center; }
.post-header-right .icon { color: var(--text-faint); cursor: pointer; }
.post-header-right .icon:hover { color: var(--accent-light); }
.post-number { color: var(--text-faint); }
.post-body { padding: 16px; flex: 1; line-height: 1.65; word-break: break-word; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin: 10px 0;
  background: rgba(239,68,68,.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
}
.post-body pre { background: var(--bg-input); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; font-size: .85em; border: 1px solid var(--border); }
.post-body code { background: var(--bg-input); padding: 2px 6px; border-radius: 3px; font-size: .88em; }
.post-signature { padding: 8px 16px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-faint); font-style: italic; }
.post-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--glass-shine);
}
.post-actions { display: flex; gap: 2px; }
.post-actions button, .post-actions a {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: .8rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 500;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.post-actions button:hover, .post-actions a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.post-actions .liked { color: var(--accent-light); text-shadow: 0 0 8px rgba(239,68,68,.3); }
.post-edited { font-size: .72rem; color: var(--text-faint); font-style: italic; }

/* === THREAD PAGE === */
.thread-locked-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.thread-page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 12px; }
.thread-page-title { font-size: 1.2rem; font-weight: 700; }
.thread-badges { display: flex; gap: 6px; margin-top: 5px; }
.thread-badge { padding: 2px 8px; border-radius: var(--radius-sm); font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.thread-badge.pinned { background: rgba(234,179,8,.08); color: var(--gold); border: 1px solid rgba(234,179,8,.15); }
.thread-badge.locked { background: rgba(139,139,149,.05); color: var(--text-faint); border: 1px solid rgba(139,139,149,.1); }
.thread-actions-bar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.post-header-icons { display: flex; gap: 6px; align-items: center; }
.post-header-icons .icon { color: var(--text-faint); cursor: pointer; transition: color .15s; }
.post-header-icons .icon:hover { color: var(--accent-light); }

/* === PAGINATION === */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .82rem;
  background: var(--bg-surface);
  font-weight: 500;
  transition: all .15s;
}
.pagination a:hover { background: var(--bg-hover); color: #fff; border-color: var(--border-active); }
.pagination .active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 12px rgba(239,68,68,.25); }
.pagination .disabled { opacity: .25; pointer-events: none; }

/* === SIDEBAR === */
.sidebar-card .card-header {
  font-size: .85rem;
  padding: 10px 14px;
  gap: 6px;
  color: var(--text-dim);
  font-weight: 600;
}
.sidebar-card .card-header .icon { color: var(--accent-light); opacity: .6; }
.sidebar-card .card-body { padding: 10px 14px; }
.trending-item {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.03);
  font-size: .82rem;
}
.trending-item:last-child { border-bottom: none; }
.trending-icon { color: var(--accent-light); flex-shrink: 0; margin-top: 2px; }
.trending-title { color: var(--text-dim); display: block; }
.trending-title:hover { color: var(--text); }
.trending-meta { color: var(--text-faint); font-size: .72rem; margin-top: 2px; }
.online-list { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: .82rem; }
.online-user { color: var(--text-dim); }
.online-user:hover { color: var(--accent-light); }
.online-user::after { content: ', '; color: var(--text-faint); }
.online-user:last-child::after { content: ''; }
.online-count {
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.03);
}
.forum-stats .stat-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .82rem; }
.forum-stats .stat-label { color: var(--text-faint); }
.forum-stats .stat-value { color: var(--text-dim); font-weight: 600; }
.forum-stats .stat-value a { color: var(--text-dim); }
.forum-stats .stat-value a:hover { color: var(--accent-light); }

/* === MEMBERS === */
.members-layout { display: flex; gap: 16px; }
.members-sidebar { width: 220px; flex-shrink: 0; }
.members-sidebar-title { font-size: 1.1rem; font-weight: 700; padding: 8px 12px; color: var(--text); }
.members-sidebar a.members-nav-link { display: block; padding: 7px 12px; color: var(--text-dim); font-size: .85rem; border-radius: var(--radius-sm); margin-bottom: 2px; font-weight: 500; transition: all .15s; }
.members-sidebar a.members-nav-link:hover { background: var(--bg-hover); color: var(--text); }
.members-sidebar a.members-nav-link.active { color: var(--accent-light); font-weight: 600; background: rgba(239,68,68,.05); border-left: 3px solid var(--accent-light); padding-left: 9px; }
.members-sidebar-section { padding: 10px 12px 6px; font-size: .9rem; font-weight: 700; color: var(--text); margin-top: 8px; }
.members-sidebar .member-grid { padding: 0 8px 8px; }
.members-sidebar .form-input { margin: 4px 8px 8px; width: calc(100% - 16px); }
.members-content { flex: 1; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; padding: 8px 0; }
.member-grid-item { text-align: center; }
.member-grid-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; margin: 0 auto 4px; display: block; }
.member-grid-name { font-size: .72rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.leaderboard-name { flex: 1; font-size: .88rem; }
.leaderboard-value { font-weight: 700; color: var(--text-dim); font-size: .88rem; }

/* === PROFILE === */
.profile-banner {
  height: 200px;
  background: linear-gradient(135deg, #181924 0%, #1e1520 25%, #261418 50%, #1e1520 75%, #181924 100%);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
}
.banner-edit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.banner-edit-btn:hover { background: rgba(0,0,0,.75); color: #fff; border-color: rgba(239,68,68,.3); }
.profile-header { display: flex; gap: 18px; padding: 0 20px 16px; margin-top: -55px; position: relative; align-items: flex-end; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar { border: 4px solid var(--bg-body) !important; box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.avatar-edit-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  background: var(--bg-surface-raised);
  border: 2px solid var(--bg-body);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.avatar-edit-btn:hover { background: var(--accent); color: #fff; box-shadow: 0 0 10px rgba(239,68,68,.4); }
.profile-info { flex: 1; padding-bottom: 4px; }
.profile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name-row .user-badge { font-size: .75rem; padding: 3px 12px; }
.profile-username { font-size: 1.5rem; font-weight: 700; }
.profile-meta { font-size: .85rem; color: var(--text-faint); margin-top: 2px; line-height: 1.65; }
.profile-meta .green-date { color: var(--green); }
.profile-header-actions { align-self: flex-start; margin-top: 60px; display: flex; gap: 8px; flex-shrink: 0; }
.profile-stats {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-top: 1px solid var(--border);
}
.profile-stat { text-align: center; padding: 12px 24px 12px 0; }
.profile-stat-label { font-size: .78rem; color: var(--text-faint); }
.profile-stat-value { font-size: 1.1rem; font-weight: 700; }
.profile-actions-bar { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.profile-tabs { display: flex; border-bottom: 2px solid var(--border); }
.profile-tab {
  padding: 10px 18px;
  color: var(--text-dim);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: #fff; border-bottom-color: var(--accent-light); }
.profile-tab-content { padding: 16px 0; }
.wall-post {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
}
.wall-post-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.wall-post-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.wall-post-author { font-weight: 600; font-size: .88rem; }
.wall-post-time { font-size: .75rem; color: var(--text-faint); }
.wall-post-content { padding: 0 16px 10px; font-size: .9rem; line-height: 1.5; }
.wall-post-actions { display: flex; gap: 12px; padding: 6px 16px; border-top: 1px solid var(--border); }
.wall-post-actions button { background: none; border: none; color: var(--text-faint); cursor: pointer; font-family: var(--font); font-size: .8rem; font-weight: 500; padding: 4px 0; display: inline-flex; align-items: center; gap: 5px; transition: color .15s; }
.wall-post-actions button:hover { color: var(--accent-light); }
.wall-post-actions button.liked { color: var(--accent-light); }
.wall-comments { border-top: 1px solid var(--border); padding: 8px 16px; }
.wall-comment { display: flex; gap: 8px; padding: 5px 0; font-size: .84rem; }
.wall-comment-avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.wall-comment-input { display: flex; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); }
.wall-comment-input input { flex: 1; padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: .82rem; }
.wall-comment-input input:focus { outline: none; border-color: var(--accent-light); }
.wall-input-box {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  align-items: center;
  box-shadow: var(--shadow);
}
.wall-input-box input { flex: 1; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: .88rem; }
.wall-input-box input:focus { outline: none; border-color: var(--accent-light); }

/* === MESSAGES === */
.messages-layout { display: flex; height: calc(100vh - 130px); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.conversation-list { width: 290px; border-right: 1px solid var(--border); overflow-y: auto; background: var(--bg-surface-raised); }
.conv-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: all .15s; }
.conv-item:hover { background: var(--bg-hover); }
.conv-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: .88rem; }
.conv-preview { font-size: .76rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-unread { background: var(--accent-light); color: #fff; font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 8px; box-shadow: 0 0 8px rgba(239,68,68,.3); }
.conv-time { font-size: .7rem; color: var(--text-faint); }
.messages-area { flex: 1; display: flex; flex-direction: column; }
.messages-header { padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.messages-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-bubble { max-width: 70%; padding: 10px 14px; border-radius: var(--radius); font-size: .88rem; line-height: 1.45; }
.msg-bubble.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent) 0%, #991b1b 100%);
  color: #fff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 12px rgba(185,28,28,.25);
}
.msg-bubble.received { align-self: flex-start; background: var(--bg-surface-raised); border-bottom-left-radius: 3px; border: 1px solid var(--border); }
.msg-time { font-size: .7rem; color: var(--text-faint); margin-top: 2px; }
.msg-read { color: var(--accent-light); font-size: .65rem; }
.messages-input { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
.messages-input input { flex: 1; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); }
.messages-input input:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(239,68,68,.08); }

/* === SEARCH === */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; }
.search-filters { display: flex; gap: 6px; margin-bottom: 16px; }
.search-filter { padding: 6px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-dim); cursor: pointer; font-size: .84rem; font-family: var(--font); font-weight: 500; transition: all .15s; }
.search-filter:hover { border-color: var(--border-active); background: var(--bg-hover); }
.search-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 10px rgba(239,68,68,.2); }
.search-result { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg-surface); backdrop-filter: var(--blur); transition: border-color .15s; }
.search-result:hover { border-color: var(--border-active); }
.search-result-title { font-weight: 600; margin-bottom: 4px; }
.search-result-title a { color: var(--text); }
.search-result-title a:hover { color: var(--accent-light); }
.search-result-snippet { font-size: .84rem; color: var(--text-dim); }
.search-result-meta { font-size: .76rem; color: var(--text-faint); margin-top: 6px; }

/* === ADMIN === */
.admin-layout { display: flex; gap: 16px; }
.admin-sidebar { width: 190px; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 7px 12px; color: var(--text-dim); font-size: .85rem; border-radius: var(--radius-sm); margin-bottom: 2px; font-weight: 500; transition: all .15s; }
.admin-sidebar a:hover { background: var(--bg-hover); color: var(--text); }
.admin-sidebar a.active { color: var(--accent-light); background: rgba(239,68,68,.05); border-left: 3px solid var(--accent-light); padding-left: 9px; }
.admin-content { flex: 1; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 8px 12px; background: var(--bg-surface-raised); border-bottom: 1px solid var(--border); font-size: .8rem; color: var(--text-faint); font-weight: 600; }
.admin-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-stat-card {
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.admin-stat-card .stat-number { font-size: 1.8rem; font-weight: 700; color: var(--accent-light); text-shadow: 0 0 20px rgba(239,68,68,.2); }
.admin-stat-card .stat-label { font-size: .8rem; color: var(--text-faint); margin-top: 4px; }

/* === EDITOR === */
.editor-toolbar {
  display: flex;
  gap: 1px;
  padding: 6px 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
  align-items: center;
}
.editor-toolbar button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all .15s;
  min-width: 30px;
  justify-content: center;
}
.editor-toolbar button:hover { background: rgba(239,68,68,.08); color: var(--accent-light); border-color: rgba(239,68,68,.15); }
.editor-toolbar button:active { background: rgba(239,68,68,.15); }
.editor-textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .85rem;
  resize: vertical;
  line-height: 1.6;
  tab-size: 2;
}
.editor-textarea:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(239,68,68,.08); }
.editor-textarea::placeholder { color: var(--text-faint); font-family: var(--font); }

/* === TOAST === */
#toast-container { position: fixed; top: 62px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: toastIn .3s ease;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.toast-success { background: rgba(34,197,94,.85); color: #fff; box-shadow: 0 4px 20px rgba(34,197,94,.3); }
.toast-error { background: rgba(239,68,68,.85); color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,.3); }
.toast-info { background: rgba(59,130,246,.85); color: #fff; box-shadow: 0 4px 20px rgba(59,130,246,.3); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg-surface-raised); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 4px; display: flex; border-radius: var(--radius-sm); transition: all .15s; }
.modal-close:hover { color: var(--accent-light); background: rgba(239,68,68,.06); }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* === SEARCH OVERLAY === */
.search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); z-index: 2000; display: flex; justify-content: center; padding-top: 80px; }
.search-modal { width: 100%; max-width: 580px; height: fit-content; }
.search-modal input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-surface-raised);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.05rem;
  font-family: var(--font);
  box-shadow: var(--shadow-lg);
}
.search-modal input:focus { outline: none; border-color: var(--accent-light); box-shadow: var(--shadow-lg), 0 0 0 3px rgba(239,68,68,.1); }

/* === NOTIFICATION DROPDOWN === */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: -40px;
  background: var(--bg-surface-raised);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 330px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1001;
}
.notif-dropdown.open { display: block; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .84rem; cursor: pointer; transition: background .15s; color: var(--text-dim); }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(239,68,68,.03); border-left: 2px solid var(--accent-light); }
.notif-item:last-child { border-bottom: none; }
.notif-text { flex: 1; }
.notif-time { font-size: .7rem; color: var(--text-faint); margin-top: 3px; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .84rem; font-weight: 600; }
.notif-header a { color: var(--accent-light); font-weight: 500; font-size: .78rem; }

/* === ACCOUNT === */
.account-layout { display: flex; gap: 16px; }
.account-sidebar { width: 190px; flex-shrink: 0; }
.account-sidebar a { display: block; padding: 7px 12px; color: var(--text-dim); font-size: .85rem; border-radius: var(--radius-sm); margin-bottom: 2px; font-weight: 500; transition: all .15s; }
.account-sidebar a:hover { background: var(--bg-hover); color: var(--text); }
.account-sidebar a.active { color: var(--accent-light); background: rgba(239,68,68,.05); border-left: 3px solid var(--accent-light); padding-left: 9px; }
.account-content { flex: 1; }

/* === LOADING === */
.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent-light); border-radius: 50%; animation: spin .6s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; justify-content: center; align-items: center; min-height: 200px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); font-size: .9rem; line-height: 1.6; }
.empty-state::before { content: ''; display: block; width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.1); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .page-wrapper { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar .card { flex: 1; min-width: 250px; }
  .post-author { width: 120px; }
  .post-author-avatar { width: 60px; height: 60px; }
}

@media (max-width: 768px) {
  /* --- Navbar --- */
  .nav-links { display: none; }
  .navbar { height: 48px; }
  .navbar-logo { font-size: 1rem; margin-right: 12px; }
  .nav-search-link span { display: none; }
  .nav-user-name { display: none; }

  /* --- Layout --- */
  .container { padding: 0 10px; }
  .page-wrapper { padding: 10px 0 24px; gap: 12px; }

  /* --- Shoutbox --- */
  .shoutbox-messages { height: 200px; padding: 6px 12px; }
  .shoutbox-input { padding: 6px 12px; }

  /* --- Categories --- */
  .cat-latest { display: none; }
  .cat-icon { width: 32px; height: 32px; font-size: .85rem; }
  .category-row { padding: 10px 12px; gap: 10px; }
  .category-section-title { padding: 8px 12px; font-size: .85rem; }

  /* --- Threads --- */
  .thread-stats, .thread-last-reply { display: none; }
  .thread-row { padding: 8px 12px; }
  .thread-title { font-size: .88rem; }
  .thread-list-header { padding: 6px 12px; }

  /* --- Posts --- */
  .post-card { flex-direction: column; }
  .post-author {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    text-align: left;
  }
  .post-author-avatar { width: 40px; height: 40px; margin: 0; flex-shrink: 0; }
  .post-author-stats { display: none; }
  .post-author-badges { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .post-author-name { font-size: .85rem; }
  .post-author-status { display: none; }
  .post-body { padding: 12px; }
  .post-header { padding: 6px 12px; }
  .post-footer { padding: 6px 12px; }
  .post-signature { padding: 6px 12px; }

  /* --- Profile --- */
  .profile-banner { height: 120px; }
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: -40px;
    padding: 0 14px 12px;
    gap: 10px;
  }
  .profile-header-actions { margin-top: 0; justify-content: center; align-self: center; }
  .profile-avatar { width: 80px; height: 80px; }
  .profile-username { font-size: 1.2rem; }
  .profile-stats { flex-wrap: wrap; justify-content: center; padding: 0 14px; }
  .profile-stat { padding: 10px 16px; }
  .profile-actions-bar { justify-content: center; flex-wrap: wrap; padding: 10px 14px; }
  .profile-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .profile-tab { padding: 8px 14px; font-size: .84rem; white-space: nowrap; }

  /* --- Messages --- */
  .messages-layout { flex-direction: column; height: auto; }
  .conversation-list { width: 100%; max-height: 250px; border-right: none; border-bottom: 1px solid var(--border); }
  .messages-body { min-height: 300px; }

  /* --- Members --- */
  .members-layout { flex-direction: column; }
  .members-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .members-sidebar a.members-nav-link { white-space: nowrap; flex-shrink: 0; }
  .members-sidebar-title { white-space: nowrap; padding: 8px 8px 8px 0; }
  .members-sidebar-section { white-space: nowrap; padding: 6px 8px; margin-top: 0; }
  .members-sidebar .member-grid { display: flex; overflow-x: auto; gap: 8px; padding: 0 8px 8px; flex-wrap: nowrap; }
  .members-sidebar .member-grid .member-grid-item { flex-shrink: 0; }

  /* --- Admin --- */
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  .admin-sidebar a { white-space: nowrap; flex-shrink: 0; }
  .admin-content { width: 100%; }
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -10px; padding: 0 10px; }
  .admin-table { min-width: 600px; }
  .admin-stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* --- Account --- */
  .account-layout { flex-direction: column; }
  .account-sidebar { width: 100%; display: flex; gap: 4px; flex-wrap: wrap; }

  /* --- Search overlay --- */
  .search-overlay { padding-top: 20px; }
  .search-modal { max-width: 100%; padding: 0 10px; }
  .search-modal input { font-size: .95rem; padding: 12px 14px; }

  /* --- User dropdown --- */
  .user-dropdown {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }

  /* --- Notification dropdown --- */
  .notif-dropdown {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: calc(100vh - 48px);
  }

  /* --- Breadcrumb --- */
  .breadcrumb {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
    padding: 10px 0;
  }
  .breadcrumb a, .breadcrumb-sep, .breadcrumb span {
    display: inline;
    vertical-align: middle;
  }

  /* --- Editor --- */
  .editor-toolbar { padding: 4px 6px; gap: 1px; }
  .editor-toolbar button { padding: 4px 6px; font-size: .78rem; min-width: 26px; }
  .editor-sep { height: 16px; margin: 0 2px; }
  .editor-textarea { min-height: 120px; padding: 10px; font-size: .82rem; }

  /* --- Reactions --- */
  .reaction-picker {
    position: fixed;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100vw - 32px);
    flex-wrap: wrap;
    justify-content: center;
    z-index: 2001;
    margin-bottom: 0;
  }

  /* --- Pagination --- */
  .pagination { flex-wrap: wrap; }
  .pagination a, .pagination span { padding: 5px 10px; font-size: .78rem; }

  /* --- Cards general --- */
  .card-header { padding: 9px 12px; font-size: .85rem; }
  .card-body { padding: 10px 12px; }

  /* --- Auth --- */
  .auth-card { padding: 24px; }

  /* --- Search page --- */
  .search-filters { flex-wrap: wrap; }
  .search-bar { flex-direction: column; }

  /* --- Modal --- */
  .modal-overlay { padding: 10px; }
  .modal { max-width: 100%; }
}

/* === EXTRA SMALL SCREENS === */
@media (max-width: 480px) {
  html { font-size: 13px; }

  /* --- Navbar --- */
  .navbar { height: 44px; }
  .navbar-logo { font-size: .9rem; margin-right: 8px; }
  .nav-icon-btn { padding: 6px; }
  .nav-user { padding: 4px 6px; margin-left: 2px; }

  /* --- Layout --- */
  .container { padding: 0 8px; }
  .page-wrapper { padding: 8px 0 20px; gap: 10px; }

  /* --- Shoutbox --- */
  .shoutbox-messages { height: 160px; padding: 4px 10px; }
  .shoutbox-msg { font-size: .8rem; }

  /* --- Categories --- */
  .cat-icon { width: 28px; height: 28px; }
  .category-row { padding: 8px 10px; gap: 8px; }
  .cat-name { font-size: .88rem; }
  .cat-stats { font-size: .72rem; }

  /* --- Threads --- */
  .thread-row { padding: 7px 10px; gap: 8px; }
  .thread-title { font-size: .84rem; }
  .thread-author { font-size: .72rem; }
  .thread-icon { width: 16px; }

  /* --- Posts --- */
  .post-author { padding: 8px 10px; gap: 8px; }
  .post-author-avatar { width: 32px; height: 32px; }
  .post-body { padding: 10px; font-size: .88rem; }
  .post-header { padding: 5px 10px; font-size: .75rem; }
  .post-footer { padding: 5px 10px; }
  .post-actions button, .post-actions a { font-size: .75rem; padding: 4px 6px; }

  /* --- Cards --- */
  .card-header { padding: 8px 10px; font-size: .82rem; }
  .card-body { padding: 8px 10px; }

  /* --- Profile --- */
  .profile-banner { height: 90px; }
  .profile-avatar { width: 64px; height: 64px; border-width: 3px; }
  .profile-header { margin-top: -32px; padding: 0 10px 10px; gap: 8px; }
  .profile-username { font-size: 1.05rem; }
  .profile-meta { font-size: .78rem; }
  .profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 0 10px;
  }
  .profile-stat { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
  .profile-stat:nth-last-child(-n+2) { border-bottom: none; }
  .profile-stat-value { font-size: .95rem; }
  .profile-stat-label { font-size: .72rem; }
  .profile-actions-bar { padding: 8px 10px; gap: 6px; }
  .profile-tab { padding: 7px 10px; font-size: .8rem; }

  /* --- Messages --- */
  .conversation-list { max-height: 200px; }
  .conv-item { padding: 8px 10px; }
  .msg-bubble { max-width: 85%; padding: 8px 10px; font-size: .84rem; }
  .messages-input { padding: 8px 10px; }

  /* --- Members --- */
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
  .member-grid-avatar { width: 40px; height: 40px; }
  .member-grid-name { font-size: .68rem; }

  /* --- Admin --- */
  .admin-stat-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-stat-card { padding: 12px; }
  .admin-stat-card .stat-number { font-size: 1.4rem; }

  /* --- Editor --- */
  .editor-toolbar button { padding: 3px 5px; font-size: .75rem; min-width: 24px; }
  .editor-textarea { min-height: 100px; padding: 8px; font-size: .8rem; }

  /* --- Auth --- */
  .auth-card { padding: 20px 16px; }
  .auth-logo h1 { font-size: 1.25rem; }

  /* --- Pagination --- */
  .pagination a, .pagination span { padding: 4px 8px; font-size: .75rem; }

  /* --- Search --- */
  .search-result { padding: 10px 12px; }
  .search-filter { padding: 5px 12px; font-size: .8rem; }

  /* --- Wall posts --- */
  .wall-post-header { padding: 8px 10px; }
  .wall-post-content { padding: 0 10px 8px; font-size: .85rem; }
  .wall-post-actions { padding: 5px 10px; }

  /* --- Buttons --- */
  .btn { padding: 6px 12px; font-size: .8rem; }
  .btn-sm { padding: 3px 8px; font-size: .74rem; }

  /* --- Sidebar cards on small --- */
  .sidebar .card { min-width: 100%; }

  /* --- Forms --- */
  .form-input, .form-textarea, .form-select { padding: 8px 10px; font-size: .85rem; }

  /* --- Thread page --- */
  .thread-page-header { flex-direction: column; gap: 8px; }
  .thread-page-title { font-size: 1.05rem; }
  .thread-actions-bar { justify-content: flex-start; flex-wrap: wrap; }

  /* --- User/Notif dropdowns --- */
  .user-dropdown { top: 44px; }
  .notif-dropdown { top: 44px; }
}

/* === REPLY SYSTEM === */
.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(239,68,68,.04);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent-light);
  gap: 8px;
}
.reply-preview-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: .84rem;
}
.reply-preview-label { color: var(--text-faint); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.reply-preview-snippet { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-shrink: 0;
}
.reply-preview-close:hover { color: var(--accent-light); background: rgba(239,68,68,.08); }
.post-reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(239,68,68,.03);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  font-size: .82rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.post-reply-ref:hover { background: rgba(239,68,68,.06); }
.reply-ref-icon { color: var(--accent-light); display: flex; }
.reply-ref-snippet { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === CONTENT FORMATTING === */
.spoiler { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 8px 0; overflow: hidden; }
.spoiler-header { padding: 8px 12px; background: var(--bg-surface-raised); cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--text-dim); display: flex; align-items: center; gap: 6px; user-select: none; }
.spoiler-header::before { content: ''; display: inline-block; width: 0; height: 0; border-left: 5px solid var(--text-faint); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .2s; }
.spoiler.open .spoiler-header::before { transform: rotate(90deg); }
.spoiler-content { display: none; padding: 10px 12px; }
.spoiler.open .spoiler-content { display: block; }
.mention { color: var(--accent-light); font-weight: 500; cursor: pointer; }
.mention:hover { text-decoration: underline; }
.quote-author { font-weight: 600; font-size: .82rem; color: var(--text-dim); margin-bottom: 4px; }
.post-inline-img {
  max-width: 100%;
  max-height: 500px;
  border-radius: var(--radius);
  margin: 8px 0;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .2s;
  display: block;
}
.post-inline-img:hover { border-color: var(--border-active); }
.post-body a { color: var(--accent-light); }
.post-body a:hover { text-decoration: underline; }
.post-body strong { color: var(--text); }
.post-body pre {
  background: rgba(0,0,0,.2);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.5;
  margin: 8px 0;
}
.post-body code { background: rgba(239,68,68,.06); color: var(--accent-light); padding: 2px 6px; border-radius: 3px; font-size: .85em; }

/* === EDITOR WRAP === */
.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, box-shadow .2s; background: var(--bg-surface); }
.editor-wrap:focus-within { border-color: var(--border-active); box-shadow: 0 0 0 3px rgba(239,68,68,.06), 0 0 16px rgba(239,68,68,.05); }
.editor-wrap .editor-toolbar { border: none; border-radius: 0; }
.editor-wrap .editor-textarea { border: none; border-radius: 0; border-top: 1px solid var(--border); }
.editor-wrap .editor-textarea:focus { box-shadow: none; }
.editor-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-textarea.drag-over { background: rgba(239,68,68,.05); border-color: var(--accent-light) !important; }

/* === REACTIONS === */
.reaction-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.reaction-btn { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 12px; border: 1px solid var(--border); background: none; color: var(--text-faint); font-size: .78rem; cursor: pointer; font-family: var(--font); transition: all .15s; }
.reaction-btn:hover { border-color: var(--border-active); background: var(--bg-hover); }
.reaction-btn.active { border-color: var(--accent-light); color: var(--accent-light); background: rgba(239,68,68,.06); }
.reaction-add-btn { padding: 3px 6px; }
.reaction-picker { display: none; position: absolute; bottom: 100%; left: 0; background: var(--bg-surface-raised); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; box-shadow: 0 8px 32px rgba(0,0,0,.5); gap: 2px; z-index: 10; margin-bottom: 4px; }
.reaction-picker.open { display: flex; }
.reaction-pick { padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; border: none; background: none; color: var(--text-dim); display: flex; transition: all .12s; font-family: var(--font); }
.reaction-pick:hover { background: var(--bg-hover); color: var(--accent-light); transform: scale(1.2); }

/* === REPUTATION === */
.rep-bar { height: 4px; background: rgba(255,255,255,.06); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.rep-bar-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width .3s; }
.rep-btn-pos { color: var(--green) !important; }
.rep-btn-pos:hover { background: rgba(34,197,94,.1) !important; }
.rep-btn-neg { color: var(--text-faint) !important; }
.rep-btn-neg:hover { background: rgba(239,68,68,.06) !important; color: var(--accent-light) !important; }

/* === HOVER CARDS === */
.hover-card {
  position: absolute;
  z-index: 1500;
  width: 280px;
  background: var(--bg-surface-raised);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  animation: hcIn .15s ease;
  pointer-events: auto;
  overflow: hidden;
}
@keyframes hcIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.hc-banner { height: 60px; background-size: cover; background-position: center; }
.hc-header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 10px 14px 0; margin-top: -20px; }
.hc-header .hc-avatar { border: 3px solid var(--bg-surface-raised) !important; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.hc-name { font-weight: 600; font-size: .9rem; }
.hc-role { font-size: .72rem; color: var(--text-faint); }
.hc-stats { display: flex; gap: 12px; font-size: .78rem; color: var(--text-dim); margin-bottom: 8px; padding: 0 14px; }
.hc-stats b { color: var(--text); }
.hc-status { font-size: .78rem; color: var(--text-faint); font-style: italic; margin-bottom: 8px; padding: 0 14px; }
.hc-actions { display: flex; gap: 6px; padding: 0 14px 12px; }

/* === LIGHTBOX === */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .2s; cursor: zoom-out;
}
.lightbox-overlay.active { opacity: 1; }
.lightbox-img { max-width: 95vw; max-height: 95vh; object-fit: contain; border-radius: 4px; cursor: default; }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; opacity: .6; }
.lightbox-close:hover { opacity: 1; }

/* === INFINITE SCROLL === */
.scroll-sentinel { height: 1px; width: 100%; }
.scroll-loading { display: flex; justify-content: center; padding: 16px 0; }

.draft-indicator {
  font-size: .72rem;
  color: var(--text-faint);
  font-style: italic;
  padding: 4px 0;
}

/* === UTILITY === */
.text-muted { color: var(--text-faint); }
.text-accent { color: var(--accent-light); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }
/* === THREAD PREFIXES === */
.thread-prefix { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 600; margin-right: 6px; vertical-align: middle; }
.prefix-filters .prefix-filter-btn { font-size: .78rem; padding: 4px 10px; }
.prefix-filters .prefix-filter-btn.active { background: var(--accent-glow); color: var(--accent-light); border-color: var(--border-active); }

/* === POLLS === */
.poll-card { margin-bottom: 16px; }
.poll-question { font-weight: 600; font-size: 1rem; margin-bottom: 12px; }
.poll-option { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: default; position: relative; overflow: hidden; transition: all .15s; }
.poll-option:not(.show-results):hover { border-color: var(--border-active); }
.poll-option.voted { border-color: var(--accent-light); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-glow); border-radius: var(--radius-sm); transition: width .4s ease; }
.poll-option-text { position: relative; z-index: 1; display: flex; justify-content: space-between; }
.poll-meta { font-size: .78rem; color: var(--text-faint); margin-top: 8px; }

/* Username role styles (.username-*) are now dynamically injected via JavaScript */
