/* ═══════════════════════════════════════════════════════════
   9MM PRO — COMMUNITY ARCHIVE
   Tactical HUD / DeFi Terminal aesthetic
   ═══════════════════════════════════════════════════════════ */

/* Force emoji codepoints to system color emoji fonts — must come BEFORE text fonts */
@font-face {
  font-family: 'Emoji';
  src: local('Segoe UI Emoji'), local('Apple Color Emoji'), local('Noto Color Emoji'), local('Twemoji Mozilla');
  unicode-range: U+200D, U+203C, U+2049, U+20E3, U+2122, U+2139, U+2194-21AA,
    U+231A-231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FA, U+24C2, U+25AA-25AB,
    U+25B6, U+25C0, U+25FB-25FE, U+2600-27BF, U+2934-2935, U+2B05-2B07, U+2B1B-2B1C,
    U+2B50, U+2B55, U+3030, U+303D, U+3297, U+3299, U+00A9, U+00AE,
    U+FE00-FE0F, U+FE30-FE4F,
    U+1F000-1FAFF, U+1F1E0-1F1FF, U+E0020-E007F;
}

/* Twemoji inline images */
img.emoji {
  height: 1.2em;
  width: 1.2em;
  margin: 0 0.05em 0 0.1em;
  vertical-align: -0.2em;
  display: inline;
}

.msg-sticker img.emoji {
  height: 48px;
  width: 48px;
}

.reaction img.emoji {
  height: 1em;
  width: 1em;
}

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

:root {
  /* Gunmetal palette */
  --bg-deep: #08090c;
  --bg: #0d0f14;
  --bg-surface: #13161e;
  --bg-elevated: #1a1e2a;
  --bg-hover: #1e2333;

  /* Brass / Gold accents */
  --brass: #c8a84e;
  --brass-dim: #8a7234;
  --brass-glow: #d4b85c;

  /* Muzzle flash */
  --flash: #e8622c;
  --flash-dim: #a04420;

  /* Text */
  --text: #c8ccd8;
  --text-bright: #e8ecf4;
  --text-dim: #5c6478;
  --text-muted: #3a3f50;

  /* Functional */
  --link: #5b9bd5;
  --border: #1e2230;
  --border-active: #2a3044;

  /* Status */
  --green: #3ddc84;
  --red: #e04050;

  /* Fonts — Emoji font-face intercepts emoji codepoints before text fonts */
  --font-display: 'Emoji', 'Outfit', 'Noto Sans', 'Segoe UI', sans-serif;
  --font-mono: 'Emoji', 'JetBrains Mono', monospace;
  --font-emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-display), var(--font-emoji);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body { display: flex; }

::selection { background: var(--brass); color: var(--bg-deep); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Scanline overlay ─── */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */

#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, var(--brass-dim) 0%, transparent 30%, transparent 70%, var(--brass-dim) 100%);
  opacity: 0.3;
}

#sidebar.collapsed { margin-left: -260px; }

/* Brand */
.sidebar-brand {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand-mark { opacity: 0.8; flex-shrink: 0; }

.brand-text h1 {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--brass);
  letter-spacing: 3px;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Stats bar */
.sidebar-stats-bar {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  line-height: 1.6;
}

.sidebar-stats-bar .stat-value { color: var(--brass); font-weight: 500; }

/* Section labels */
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 14px 16px 6px;
}

/* Topic list */
#topic-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 4px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: all 0.15s;
  position: relative;
  border-left: 2px solid transparent;
  width: 100%;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  font-family: var(--font-display);
  text-align: left;
}

.topic-item::before {
  content: '#';
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.15s;
}

.topic-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.topic-item:hover::before { color: var(--text-dim); }

.topic-item.active {
  color: var(--text-bright);
  background: linear-gradient(90deg, rgba(200, 168, 78, 0.08) 0%, transparent 100%);
  border-left-color: var(--brass);
}

.topic-item.active::before { color: var(--brass); }

.topic-item .t-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topic-item .t-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.topic-item.active .t-count { color: var(--brass-dim); }

/* Leaderboard */
#stats-panel {
  max-height: 220px;
  overflow-y: auto;
  padding: 0 16px 16px;
  position: relative;
}

#top-users {
  list-style: none;
  counter-reset: rank;
}

#top-users li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}

#top-users li::before {
  content: counter(rank);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

#top-users li:nth-child(1)::before { color: var(--brass); }
#top-users li:nth-child(2)::before { color: #a0a0a8; }
#top-users li:nth-child(3)::before { color: #a06030; }

.user-name { color: var(--text-dim); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-count { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.footer-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Topic header */
#topic-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

#sidebar-toggle:hover { color: var(--text); }

.header-channel {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.channel-hash {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--brass-dim);
}

#topic-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
}

.header-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Search trigger button */
#search-open {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13px;
  transition: all 0.15s;
}

#search-open:hover { border-color: var(--brass-dim); color: var(--text); }

#search-open kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Search modal */
#search-modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
#search-modal.modal-hidden { display: none; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 9, 12, 0.8); backdrop-filter: blur(4px); }

.modal-content {
  position: relative;
  width: 640px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.search-header svg { flex-shrink: 0; }

#search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-bright);
  font-family: var(--font-display);
  font-size: 15px;
  outline: none;
}

#search-input::placeholder { color: var(--text-muted); }

#search-user-filter {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 3px;
  width: 180px;
}

#search-user-filter:focus { border-color: var(--brass-dim); outline: none; color: var(--text); }
#search-user-filter::placeholder { color: var(--text-muted); }

#search-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

#search-close:hover { color: var(--text); }

#search-status {
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

#search-results {
  overflow-y: auto;
  flex: 1;
}

.search-result {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result:hover { background: var(--bg-hover); }

.sr-topic {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--brass-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 70px;
  padding-top: 2px;
}

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

.sr-name {
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.sr-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.sr-text {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sr-text mark {
  background: rgba(200, 168, 78, 0.25);
  color: var(--text-bright);
  border-radius: 2px;
  padding: 0 1px;
}

.search-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ─── Filter bar ─── */
#filter-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  background: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  min-height: 32px;
}

.filter-btn:hover {
  color: var(--text-dim);
  background: var(--bg-surface);
}

.filter-btn.active {
  color: var(--brass);
  background: rgba(200, 168, 78, 0.08);
  border-color: var(--brass-dim);
}

.filter-btn svg { flex-shrink: 0; }

/* ─── Focus states (accessibility) ─── */
*:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ─── Messages ─── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  position: relative;
}

.msg {
  display: flex;
  gap: 12px;
  padding: 6px 24px;
  transition: background 0.15s;
  position: relative;
}

.msg:hover { background: rgba(19, 22, 30, 0.7); }

.msg.highlight {
  background: rgba(200, 168, 78, 0.1);
  border-left: 2px solid var(--brass);
  animation: highlight-fade 3s ease-out forwards;
}

@keyframes highlight-fade {
  0% { background: rgba(200, 168, 78, 0.15); border-left-color: var(--brass); }
  100% { background: transparent; border-left-color: transparent; }
}

/* Avatar */
.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--bg-deep);
  flex-shrink: 0;
  margin-top: 2px;
}

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

/* Message header */
.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.msg-name {
  font-size: 13px;
  font-weight: 600;
  cursor: default;
}

.msg-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.msg-permalink {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
}

.msg:hover .msg-permalink { opacity: 1; }
.msg-permalink:hover { color: var(--brass) !important; }

/* Message text */
.msg-text {
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

.msg-text a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(91, 155, 213, 0.2);
  transition: border-color 0.15s;
}

.msg-text a:hover { border-color: var(--link); }

/* Reply indicator */
.msg-reply {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border-left: 2px solid var(--brass-dim);
  padding: 1px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.15s;
  display: inline-block;
}

.msg-reply:hover { color: var(--brass); }

/* Forwarded */
.msg-forwarded {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 3px;
}

.msg-forwarded::before {
  content: '>';
  font-family: var(--font-mono);
  margin-right: 4px;
  color: var(--text-muted);
  font-style: normal;
}

/* Media */
.msg-media { margin-top: 6px; }

.msg-media img {
  max-width: 380px;
  max-height: 280px;
  border-radius: 4px;
  cursor: pointer;
  object-fit: cover;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.msg-media img:hover { border-color: var(--brass-dim); }

.msg-media video {
  max-width: 380px;
  max-height: 280px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
}

.msg-media video.video-gif {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  max-height: 250px;
}

.msg-sticker { font-size: 48px; line-height: 1.2; font-family: var(--font-emoji); }

.msg-text, .msg-name, .msg-forwarded, .msg-reactions, .topic-item .t-name, #top-users .user-name {
  font-family: var(--font-display), var(--font-emoji);
}

.msg-service span {
  font-family: var(--font-mono), var(--font-display), var(--font-emoji);
}

/* Audio / Voice message */
.msg-audio {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
}

.msg-audio audio {
  width: 100%;
  height: 36px;
  border-radius: 4px;
}

.msg-audio audio::-webkit-media-controls-panel { background: var(--bg-elevated); }

.audio-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.audio-fallback {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-block;
}

/* File attachment — clickable link */
.msg-file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-top: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}

.msg-file-link:hover {
  border-color: var(--brass-dim);
  background: var(--bg-hover);
  color: var(--text);
}

.msg-file-link svg { color: var(--brass-dim); flex-shrink: 0; }
.msg-file-link .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.msg-file-link .file-action {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--brass);
  opacity: 0;
  transition: opacity 0.15s;
}
.msg-file-link:hover .file-action { opacity: 1; }

/* Reactions */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.4;
}

.reaction .r-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* Service messages */
.msg-service {
  text-align: center;
  padding: 3px 24px;
  margin: 1px 0;
}

.msg-service span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(30, 35, 51, 0.5);
  padding: 3px 14px;
  border-radius: 10px;
  display: inline-block;
  letter-spacing: 0.3px;
}

/* Date separator */
.date-sep {
  text-align: center;
  padding: 16px 0 10px;
  position: relative;
}

.date-sep::before {
  content: '';
  position: absolute;
  left: 60px;
  right: 24px;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.date-sep span {
  position: relative;
  background: var(--bg);
  padding: 2px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}

.empty-state svg { opacity: 0.3; }

/* ─── Message grouping ─── */
.msg-grouped { padding-top: 1px; padding-bottom: 1px; }

.msg-avatar-spacer {
  width: 34px;
  flex-shrink: 0;
}

.msg-grouped .msg-body { position: relative; }

.msg-date-inline {
  position: absolute;
  left: -46px;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: transparent;
  width: 34px;
  text-align: center;
  transition: color 0.15s;
  pointer-events: none;
}

.msg-grouped:hover .msg-date-inline { color: var(--text-muted); }

.msg-permalink-grouped {
  position: absolute;
  right: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
  padding: 0 4px;
}

.msg-grouped:hover .msg-permalink-grouped { opacity: 1; }
.msg-permalink-grouped:hover { color: var(--brass) !important; }

/* ─── Skeleton loading ─── */
.skeleton-msg { pointer-events: none; }

.skeleton-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: 3px;
  background: var(--bg-elevated);
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ─── Scroll to top ─── */
#scroll-top {
  position: absolute;
  bottom: 60px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, background 0.15s, color 0.15s;
  z-index: 10;
}

#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { background: var(--bg-hover); color: var(--brass); border-color: var(--brass-dim); }

/* ─── Pagination ─── */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#pagination button {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

#pagination button:not(:disabled):hover {
  border-color: var(--brass-dim);
  color: var(--brass);
}

#pagination button:disabled { opacity: 0.25; cursor: default; }

#page-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: center;
}

#page-jump {
  font-family: var(--font-mono);
  font-size: 11px;
  width: 48px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 4px;
  border-radius: 3px;
  -moz-appearance: textfield;
}

#page-jump::-webkit-inner-spin-button,
#page-jump::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

#page-jump:focus { border-color: var(--brass-dim); outline: none; }

/* ─── Lightbox ─── */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 12, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

#lightbox.hidden { display: none; }

#lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  font-size: 28px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
  font-family: var(--font-display);
}

#lightbox-close:hover { color: var(--text); }

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

/* ─── Toast ─── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brass);
  color: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 8px 20px;
  border-radius: 3px;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  pointer-events: none;
}

#toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Loading ─── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    z-index: 100;
    height: 100%;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  #sidebar.collapsed {
    margin-left: -260px;
    box-shadow: none;
  }

  #search-input { width: 120px !important; }
  #search-input:focus { width: 160px !important; }

  .msg { padding: 6px 12px; }
  .msg-media img, .msg-media video { max-width: 260px; }
}

/* ═══════════════════════════════════════════════════════════
   ENTRY DISCLAIMER MODAL
   ═══════════════════════════════════════════════════════════ */
.disclaimer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background:
    radial-gradient(circle at 50% 50%, rgba(200,168,78,0.05) 0%, rgba(8,9,12,0.96) 60%),
    rgba(8,9,12,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  animation: disclaimerFadeIn 0.35s cubic-bezier(0.2,0.8,0.2,1);
}

.disclaimer-overlay.is-closing {
  animation: disclaimerFadeOut 0.25s ease forwards;
}

@keyframes disclaimerFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes disclaimerFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.disclaimer-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid rgba(200,168,78,0.25);
  max-width: 640px;
  width: 100%;
  padding: 44px 44px 32px;
  color: var(--text);
  font-family: var(--font-display), var(--font-emoji);
  box-shadow:
    0 0 0 1px rgba(200,168,78,0.08),
    0 30px 80px -20px rgba(0,0,0,0.6),
    0 0 120px -40px rgba(200,168,78,0.35);
  animation: disclaimerCardIn 0.45s cubic-bezier(0.2,0.8,0.2,1);
}

@keyframes disclaimerCardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bracket corners */
.disclaimer-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--brass);
  pointer-events: none;
}
.disclaimer-bracket-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.disclaimer-bracket-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.disclaimer-bracket-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.disclaimer-bracket-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.disclaimer-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--brass);
  margin-bottom: 14px;
  text-transform: uppercase;
}

.disclaimer-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  text-shadow: 0 0 28px rgba(200,168,78,0.25);
}

.disclaimer-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin: 0 0 24px;
  text-transform: uppercase;
}

.disclaimer-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 22px;
}
.disclaimer-body p { margin: 0 0 12px; }
.disclaimer-body p:last-child { margin-bottom: 0; }
.disclaimer-body strong {
  color: var(--text-bright);
  font-weight: 600;
}

.disclaimer-points {
  list-style: none;
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid rgba(200,168,78,0.18);
  background: rgba(200,168,78,0.035);
}
.disclaimer-points li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text);
  padding: 4px 0;
}
.disclaimer-points li + li {
  border-top: 1px dashed rgba(200,168,78,0.12);
  margin-top: 4px;
  padding-top: 8px;
}
.disclaimer-points li span {
  color: var(--brass);
  font-weight: 600;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.disclaimer-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.disclaimer-btn {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 20px;
  border: 1px solid;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  text-decoration: none;
  background: transparent;
}

.disclaimer-btn-primary {
  border-color: var(--brass);
  color: var(--brass);
}
.disclaimer-btn-primary:hover {
  background: var(--brass);
  color: var(--bg-deep);
  box-shadow: 0 0 40px -8px rgba(200,168,78,0.6);
}
.disclaimer-btn-primary:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.disclaimer-btn-secondary {
  border-color: rgba(255,255,255,0.15);
  color: var(--text-dim);
}
.disclaimer-btn-secondary:hover {
  border-color: rgba(255,255,255,0.4);
  color: var(--text-bright);
}

.disclaimer-footer {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.25);
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-transform: uppercase;
}

@media (max-width: 600px) {
  .disclaimer-card { padding: 32px 24px 24px; }
  .disclaimer-title { font-size: 26px; }
  .disclaimer-body { font-size: 13px; }
  .disclaimer-actions { flex-direction: column; }
}

