/* ============================================================
   FORUM STYLESHEET — ZDoom-inspired dark terminal aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Teko:wght@400;500;600&family=Source+Sans+3:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg:        #0d0f12;
  --bg2:       #13161b;
  --bg3:       #1a1e25;
  --border:    #2a2f3a;
  --border2:   #3a4050;
  --accent:    #c0392b;
  --accent2:   #e74c3c;
  --gold:      #f39c12;
  --text:      #c8cdd6;
  --text2:     #7a8394;
  --text3:     #4a5060;
  --green:     #27ae60;
  --blue:      #2980b9;
  --white:     #eef0f4;
  --pin:       #2c3e50;
  --font-mono: 'Share Tech Mono', monospace;
  --font-head: 'Teko', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

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

/* ---- SCANLINE OVERLAY ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ---- HEADER ---- */
#site-header {
  background: var(--bg2);
  border-bottom: 2px solid var(--accent);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(192, 57, 43, 0.3);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 54px;
}

.site-logo {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--white);
  text-transform: uppercase;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo span { color: var(--accent); }

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.header-nav a {
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--accent2); text-decoration: none; }

#nav-user {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 12px;
}

#nav-user::before { content: '> '; color: var(--text3); }

/* ---- MAIN LAYOUT ---- */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ---- BREADCRUMB ---- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}
.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--accent2); }
.breadcrumb span { color: var(--text3); margin: 0 6px; }

/* ---- PAGE TITLE ---- */
.page-title {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--white);
  text-transform: uppercase;
  margin-bottom: 6px;
  line-height: 1;
}

.page-subtitle {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ---- CATEGORY BLOCK ---- */
.category-block {
  margin-bottom: 28px;
}

.category-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 12px;
  background: rgba(192, 57, 43, 0.08);
  border-left: 3px solid var(--accent);
  margin-bottom: 1px;
}

/* ---- TABLE ---- */
.forum-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border: 1px solid var(--border);
}

.forum-table thead th {
  background: var(--bg3);
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.forum-table thead th.num { text-align: center; width: 80px; }

.forum-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.forum-table tbody tr:last-child { border-bottom: none; }
.forum-table tbody tr:hover { background: var(--bg3); }

.forum-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.forum-table td.num {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text2);
  width: 80px;
}

/* Forum/Thread icon cell */
td.icon-cell {
  width: 42px;
  padding-right: 0;
  text-align: center;
}

.forum-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border2);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--bg3);
}

/* Main title cell */
td.title-cell a.row-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
}

td.title-cell a.row-title:hover { color: var(--accent2); text-decoration: none; }

td.title-cell .row-desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

td.title-cell .row-meta {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-top: 4px;
}

td.title-cell .row-meta a { color: var(--text2); }

/* Pinned badge */
.badge-pin {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 6px;
}

.badge-lock {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  background: rgba(74, 80, 96, 0.2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 6px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 9px 20px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
  text-decoration: none;
}

.btn:hover { border-color: var(--accent2); color: var(--white); text-decoration: none; background: rgba(231, 76, 60, 0.08); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: var(--white); }

.btn-sm {
  font-size: 11px;
  padding: 5px 12px;
}

/* ---- TOOLBAR (above thread list, etc.) ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; gap: 8px; }
.toolbar-right { display: flex; gap: 8px; }

/* ---- POSTS ---- */
.post-block {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  background: var(--bg2);
  margin-bottom: 12px;
}

.post-sidebar {
  width: 150px;
  flex-shrink: 0;
  background: var(--bg3);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.post-avatar {
  width: 64px;
  height: 64px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--text3);
  overflow: hidden;
}

.post-avatar img { width: 100%; height: 100%; object-fit: cover; background: transparent; }
.post-avatar:has(img) { background: transparent; border-color: transparent; }

.post-username {
  font-weight: 600;
  font-size: 14px;
  color: var(--white);
  word-break: break-all;
}

.post-usermeta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.5px;
}

.post-postcount {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
}
.post-postcount span { color: var(--gold); }

.post-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.post-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.2);
}

.post-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.5px;
}

.post-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}

.post-body {
  padding: 16px;
  flex: 1;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- REPLY BOX ---- */
.reply-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 20px;
  margin-top: 24px;
}

.reply-box h3 {
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 14px;
  font-weight: 500;
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 2px;
  transition: border-color 0.15s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent2);
}

.form-group textarea { min-height: 120px; }

/* ---- LOGIN PAGE ---- */
.auth-wrap {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 20px;
}

.auth-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 32px;
}

.auth-title {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--white);
  margin-bottom: 4px;
}

.auth-subtitle { color: var(--text2); font-size: 13px; margin-bottom: 24px; }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text2);
}

/* ---- NOTICE / ALERT ---- */
.notice {
  padding: 10px 14px;
  border-left: 3px solid var(--border2);
  background: rgba(255,255,255,0.03);
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 14px;
  font-family: var(--font-mono);
}

.notice.error { border-color: var(--accent); color: #e88; background: rgba(192,57,43,0.08); }
.notice.success { border-color: var(--green); color: #8d8; background: rgba(39,174,96,0.08); }
.notice.info { border-color: var(--blue); color: #8ad; background: rgba(41,128,185,0.08); }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pagination a, .pagination span {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  border-radius: 2px;
  text-decoration: none;
  transition: all 0.1s;
}

.pagination a:hover { border-color: var(--accent2); color: var(--white); }
.pagination .active { border-color: var(--accent); color: var(--accent2); background: rgba(192,57,43,0.1); }

/* ---- FOOTER ---- */
#site-footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 1px;
  margin-top: auto;
}

/* ---- LOADING ---- */
.loading {
  text-align: center;
  padding: 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--accent);
  margin-left: 6px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---- THREAD TITLE on thread page ---- */
.thread-title-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.thread-title-bar h1 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1.1;
}

.thread-title-bar .thread-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

.thread-title-bar .thread-meta a { color: var(--text2); }

/* ---- INDEX LAYOUT WITH SIDEBAR ---- */
.index-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.index-main {
  flex: 1;
  min-width: 0;
}

.index-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 10px 14px;
  background: rgba(192, 57, 43, 0.08);
  border-bottom: 1px solid var(--border);
}

.recent-post-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}

.recent-post-item:hover {
  background: var(--bg3);
  text-decoration: none;
}

.recent-post-thread {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-post-snippet {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-post-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}

/* ---- BBCODE FORMATTING ---- */
.bb-quote {
  border-left: 3px solid var(--accent);
  background: rgba(192, 57, 43, 0.06);
  margin: 8px 0;
  border-radius: 0 2px 2px 0;
  overflow: hidden;
}

.bb-quote-header {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--accent2);
  padding: 8px 14px 4px;
  font-weight: 600;
}

.bb-quote-body {
  padding: 6px 14px 10px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.6;
  border-left: none;
}

.bb-quote .bb-quote {
  border-left-color: var(--border2);
  background: rgba(255,255,255,0.02);
}

/* Code blocks with syntax highlighting */
.bb-codeblock {
  background: #0a0c0f;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 4;
}

.bb-codeblock code {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

.bb-codeblock-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

/* Prism.js dark theme overrides to match forum aesthetic */
.bb-codeblock .token.comment,
.bb-codeblock .token.prolog,
.bb-codeblock .token.doctype,
.bb-codeblock .token.cdata { color: #4a5568; font-style: italic; }

.bb-codeblock .token.punctuation { color: #7a8394; }

.bb-codeblock .token.property,
.bb-codeblock .token.tag,
.bb-codeblock .token.boolean,
.bb-codeblock .token.number,
.bb-codeblock .token.constant,
.bb-codeblock .token.symbol { color: #e74c3c; }

.bb-codeblock .token.selector,
.bb-codeblock .token.attr-name,
.bb-codeblock .token.string,
.bb-codeblock .token.char,
.bb-codeblock .token.builtin { color: #27ae60; }

.bb-codeblock .token.operator,
.bb-codeblock .token.entity,
.bb-codeblock .token.url { color: #f39c12; }

.bb-codeblock .token.atrule,
.bb-codeblock .token.attr-value,
.bb-codeblock .token.keyword { color: #2980b9; }

.bb-codeblock .token.function,
.bb-codeblock .token.class-name { color: #f39c12; }

.bb-codeblock .token.regex,
.bb-codeblock .token.important,
.bb-codeblock .token.variable { color: #e67e22; }

.bb-codeblock .token.important,
.bb-codeblock .token.bold { font-weight: bold; }

.bb-codeblock .token.italic { font-style: italic; }

/* Inline code (no language) */
.bb-code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--gold);
}

.bb-link {
  color: var(--accent2);
  text-decoration: underline;
  text-decoration-style: dotted;
}

.bb-link:hover {
  color: var(--white);
  text-decoration-style: solid;
}

.bb-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin: 6px 0;
  display: block;
  cursor: pointer;
  transition: border-color 0.15s;
}

.bb-img:hover { border-color: var(--accent2); }

/* YouTube / embedded video */
.bb-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  max-width: 640px;
}

.bb-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Live preview panel */
.fmt-preview {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-top: 1px dashed var(--border);
  padding: 0;
  margin-bottom: 10px;
  max-height: 500px;
  overflow-y: auto;
}

.fmt-preview-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.fmt-preview-content {
  padding: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  color: var(--text);
}

/* ---- FORMATTING TOOLBAR ---- */
.fmt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.fmt-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}

/* Toolbar in compose slot (conversations) */
#compose-toolbar-slot .fmt-toolbar {
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  margin-bottom: 0;
}

#compose-toolbar-slot + .compose-inner textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.fmt-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.12s;
  line-height: 1;
  letter-spacing: 0.5px;
}

.fmt-btn:hover {
  border-color: var(--accent2);
  color: var(--white);
  background: rgba(231, 76, 60, 0.1);
}

.fmt-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* ---- QUOTE BUTTON ON POSTS ---- */
.post-actions {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.post-action-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.12s;
}

.post-action-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
  background: rgba(231, 76, 60, 0.06);
}

/* ---- ADMIN TOOLBAR ---- */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.2);
  border-left: 3px solid var(--accent);
  margin-top: 10px;
  flex-wrap: wrap;
}

.admin-toolbar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent2);
  margin-right: 4px;
}

/* ---- INLINE EDIT FORM ---- */
.edit-form textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 2px;
  resize: vertical;
  outline: none;
  min-height: 100px;
}

.edit-form textarea:focus {
  border-color: var(--accent2);
}

.admin-danger {
  color: var(--accent2);
  border-color: rgba(192, 57, 43, 0.4);
}

.admin-danger:hover {
  background: rgba(192, 57, 43, 0.15);
  border-color: var(--accent2);
  color: var(--white);
}

/* ---- NOTIFICATIONS ---- */
.notif-bell {
  position: relative;
  cursor: pointer;
  color: var(--text2);
  font-size: 14px;
  transition: color 0.15s;
  background: none;
  border: none;
  font-family: var(--font-mono);
  padding: 0;
}

.notif-bell:hover { color: var(--white); }

.notif-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--accent);
  color: var(--white);
  font-size: 9px;
  font-family: var(--font-mono);
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  animation: notifPulse 0.3s ease-out;
}

@keyframes notifPulse {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Toast notification */
.toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  max-width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s;
}

.toast:hover { border-left-color: var(--accent2); }

.toast-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--accent2);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.toast-body {
  color: var(--text2);
  line-height: 1.4;
}

.toast.fade-out { opacity: 0; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Notification dropdown */
.notif-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.notif-dropdown.open { display: block; }

.notif-dropdown-header {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-dropdown-header a {
  font-size: 10px;
  color: var(--accent2);
  cursor: pointer;
}

.notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  display: block;
  text-decoration: none;
  color: inherit;
}

.notif-item:hover { background: var(--bg3); text-decoration: none; }

.notif-item.unread { border-left: 2px solid var(--accent); }

.notif-item-title {
  font-size: 13px;
  color: var(--white);
  margin-bottom: 2px;
}

.notif-item-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}

.notif-empty {
  padding: 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}

.notif-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* ---- RESPONSIVE ---- */

/* Prevent horizontal scroll everywhere */
html, body { overflow-x: hidden; }

/* Tablet */
@media (max-width: 768px) {
  .post-sidebar { width: 120px; }
  .post-avatar { width: 48px; height: 48px; font-size: 18px; }
  .header-nav { gap: 12px; }
  .page-wrap { padding: 16px 12px 40px; }
  .notif-dropdown { width: 300px; right: -20px; }
  .index-sidebar { width: 220px; }
}

/* Mobile */
@media (max-width: 640px) {
  /* -- Global overflow protection -- */
  .page-wrap, .post-body, .bb-quote-body, .msg-text {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* -- Header: two rows — logo left, nav right, wrap onto second line -- */
  #site-header { padding: 0 10px; }

  .header-inner {
    height: auto;
    min-height: 44px;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 8px 0;
  }

  .site-logo {
    font-size: 20px;
    letter-spacing: 1px;
  }

  .header-nav {
    width: 100%;
    gap: 12px;
    font-size: 11px;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 4px;
    border-top: 1px solid var(--border);
  }

  #nav-user {
    font-size: 11px;
    width: 100%;
    margin-bottom: 2px;
  }
  #nav-user::before { content: none; }

  .notif-wrapper { order: -1; }

  /* -- Page layout -- */
  .index-layout { flex-direction: column; }
  .index-sidebar { width: 100%; }
  .page-wrap { padding: 14px 12px 30px; }
  .page-title { font-size: 24px; letter-spacing: 1px; }
  .page-subtitle { font-size: 13px; margin-bottom: 16px; }
  .breadcrumb { font-size: 11px; margin-bottom: 10px; }

  /* -- Tables: card-style layout -- */
  .forum-table thead { display: none; }
  .forum-table td.num { display: none; }
  .forum-table td { padding: 10px 12px; }
  .forum-table td.icon-cell { width: 32px; padding-right: 0; }
  .forum-icon { width: 22px; height: 22px; font-size: 10px; }
  td.title-cell a.row-title { font-size: 14px; }
  td.title-cell .row-desc { font-size: 12px; }
  td.title-cell .row-meta { font-size: 10px; }

  /* -- Posts: sidebar becomes compact header bar -- */
  .post-block {
    flex-direction: column;
    margin-bottom: 10px;
  }

  .post-sidebar {
    width: 100%;
    flex-shrink: 1;
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 8px 12px;
    gap: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .post-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 10px;
  }

  /* Group username + meta inline */
  .post-username {
    font-size: 13px;
    margin-right: 8px;
    word-break: normal;
  }

  .post-usermeta {
    font-size: 9px;
    margin-right: 8px;
  }

  .post-postcount {
    font-size: 9px;
    margin-left: auto;
  }

  .post-body {
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
  }

  .post-header { padding: 6px 12px; }
  .post-date { font-size: 10px; }
  .post-num { font-size: 10px; }

  .post-actions { padding: 6px 12px; }
  .post-action-btn { padding: 6px 12px; font-size: 10px; }

  /* -- Thread title -- */
  .thread-title-bar { padding: 10px 12px; border-left-width: 3px; }
  .thread-title-bar h1 { font-size: 20px; letter-spacing: 0.5px; }
  .thread-title-bar .thread-meta { font-size: 10px; }

  /* -- Toolbar -- */
  .toolbar { flex-wrap: wrap; gap: 6px; }
  .btn-sm { font-size: 10px; padding: 6px 10px; }

  /* -- Reply box -- */
  .reply-box { padding: 12px; margin-top: 16px; }
  .reply-box h3 { font-size: 18px; margin-bottom: 10px; }
  .form-group textarea {
    min-height: 100px;
    font-size: 15px;
    padding: 10px;
  }
  .form-group input {
    font-size: 15px;
    padding: 10px;
  }
  .form-group label { font-size: 10px; }

  /* -- Formatting toolbar: scrollable row, always above textarea -- */
  .form-group {
    display: flex;
    flex-direction: column;
  }

  .fmt-toolbar {
    padding: 6px 8px;
    gap: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    width: 100%;
    display: flex;
  }

  .fmt-toolbar + textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
    width: 100%;
  }

  .fmt-btn {
    font-size: 11px;
    padding: 6px 10px;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .fmt-sep { margin: 0 3px; height: 16px; flex-shrink: 0; }

  /* -- BBCode content -- */
  .bb-quote { margin: 8px 0; }
  .bb-quote-header { padding: 6px 10px 2px; font-size: 10px; }
  .bb-quote-body { padding: 4px 10px 8px; font-size: 13px; }
  .bb-img { max-width: 100%; height: auto; }
  .bb-code { font-size: 12px; word-break: break-all; }

  /* -- Notifications -- */
  .notif-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    margin-top: 0;
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.6);
  }

  .notif-item { padding: 12px 14px; }
  .notif-item-title { font-size: 14px; }
  .notif-item-meta { font-size: 11px; }

  .toast-container { top: auto; bottom: 12px; right: 10px; left: 10px; }
  .toast { max-width: none; font-size: 13px; padding: 12px 14px; }

  /* -- Conversations -- */
  .msg-bubble { max-width: 90%; }
  .msg-bubble.mine { max-width: 90%; }
  .msg-avatar { width: 28px; height: 28px; font-size: 13px; flex-shrink: 0; }
  .msg-text { font-size: 14px; padding: 8px 10px; }
  .msg-meta { font-size: 9px; }

  .compose-box { padding: 10px; }
  .compose-inner { gap: 8px; }
  .compose-inner textarea {
    font-size: 15px;
    padding: 10px;
    min-height: 40px;
  }
  .compose-inner .btn { padding: 10px 16px; font-size: 11px; }

  .other-header { padding: 10px 12px; gap: 10px; }
  .other-header-avatar { width: 36px; height: 36px; }
  .other-header-name { font-size: 18px; }

  /* -- Messages inbox list -- */
  .convo-row { padding: 12px; gap: 10px; }
  .convo-avatar { width: 40px; height: 40px; font-size: 18px; }
  .convo-name { font-size: 15px; }
  .convo-preview { font-size: 13px; }
  .convo-time { font-size: 10px; }
  .unread-dot { width: 10px; height: 10px; }

  /* -- Auth -- */
  .auth-wrap { margin: 20px auto; padding: 0 12px; }
  .auth-box { padding: 20px; }
  .auth-title { font-size: 26px; }

  /* -- Pagination: bigger touch targets -- */
  .pagination { flex-wrap: wrap; gap: 4px; }
  .pagination a, .pagination span {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 36px;
    text-align: center;
  }

  /* -- Modal: full width on mobile -- */
  .modal-bg { align-items: flex-end; }
  .modal-box {
    padding: 20px;
    margin: 0;
    max-width: none;
    border-radius: 6px 6px 0 0;
  }
  .modal-title { font-size: 20px; }
}

/* Small mobile */
@media (max-width: 380px) {
  .site-logo { font-size: 18px; }
  .header-nav { gap: 10px; font-size: 10px; }
  .page-title { font-size: 20px; }
  .thread-title-bar h1 { font-size: 18px; }
  .post-body { padding: 10px; font-size: 13px; }
  .post-username { font-size: 12px; }
  .fmt-btn { font-size: 10px; padding: 5px 8px; }
  .btn { padding: 8px 14px; font-size: 11px; }
  .btn-sm { padding: 6px 10px; font-size: 10px; }
}
