/* =====================
   DESIGN TOKENS — Warm Earthy Dark
   ===================== */
:root {
  --bg:        #111318;
  --surface:   #1a1c24;
  --surface2:  #21232e;
  --surface3:  #292b38;
  --border:    #2c2f3f;
  --border2:   #383b4f;

  --accent:    #d4704a;
  --accent2:   #e8895e;
  --accent-bg: rgba(212,112,74,.12);

  --blue:      #6b93c4;
  --blue-bg:   rgba(107,147,196,.12);

  --text:      #dde1f0;
  --text2:     #8b90aa;
  --text3:     #5c6080;

  --success:   #5d9c6a;
  --danger:    #c45858;
  --warn:      #c4a248;

  --radius:    6px;
  --radius-lg: 12px;
  --nav-h:     52px;
  --transition: 0.18s ease;
}

/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea { font-family: inherit; }
img { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* =====================
   NAVBAR
   ===================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--nav-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}

.nav-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-logo { font-size: 22px; line-height: 1; }
.nav-logo svg { display: block; }

.nav-brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: .01em;
}
.nav-brand strong { color: var(--accent); }

.nav-center { flex: 1; max-width: 560px; margin: 0 auto; }

.nav-search {
  width: 100%;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--surface3);
  font-size: 14px;
  outline: none;
  color: var(--text);
  transition: var(--transition);
}
.nav-search::placeholder { color: var(--text3); }
.nav-search:focus { border-color: var(--accent); background: var(--surface2); box-shadow: 0 0 0 2px var(--accent-bg); }

.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-link { display: flex; align-items: center; gap: 8px; }

.nav-msg-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 6px;
  border-radius: var(--radius);
  transition: var(--transition);
  color: var(--text2);
}
.nav-msg-btn:hover { background: var(--surface3); color: var(--text); }

.msg-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-nickname-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--surface3);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: var(--transition);
  max-width: 160px;
  overflow: hidden;
}
.nav-nickname-chip:hover { border-color: var(--accent); color: var(--text); }
.nav-nickname-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-sub-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border-left: 1px solid var(--border2);
  padding-left: 12px;
}

/* =====================
   PWA INSTALL BANNER
   ===================== */
.pwa-install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, #1e2230 0%, #1a1c28 100%);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
}
.pwa-install-banner .pwa-icon { font-size: 24px; flex-shrink: 0; }
.pwa-install-banner .pwa-text { flex: 1; }
.pwa-install-banner .pwa-text strong { display: block; font-size: 14px; color: var(--text); }
.pwa-install-banner .pwa-text span { color: var(--text2); font-size: 12px; }
.pwa-install-banner .pwa-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.pwa-install-banner .pwa-close {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 18px; padding: 4px;
  border-radius: 4px; line-height: 1;
}
.pwa-install-banner .pwa-close:hover { color: var(--text); background: var(--surface3); }

/* =====================
   BUTTONS
   ===================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: 20px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: .02em;
}
.btn-primary:hover { background: var(--accent2); box-shadow: 0 2px 10px rgba(212,112,74,.35); }
.btn-primary:active { transform: scale(.97); }
.btn-lg { padding: 10px 28px; font-size: 15px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--text2); color: var(--text); background: var(--surface3); }

.btn-ghost-sm {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost-sm:hover { border-color: var(--accent); color: var(--accent); }

.full-width { width: 100%; margin-top: 8px; text-align: center; }

/* =====================
   PAGE LAYOUT
   ===================== */
.page-layout {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 16px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.feed-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-col {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =====================
   HOME HERO
   ===================== */
.home-hero {
  background: linear-gradient(160deg, #191b23 0%, #14151e 50%, #1b1520 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 20px 36px;
  text-align: center;
}
.home-hero-content { max-width: 560px; margin: 0 auto; }
.home-hero-icon { font-size: 48px; margin-bottom: 12px; line-height: 1; }
.home-hero-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -.02em;
}
.home-hero-sub {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.6;
}
.live-activity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text2);
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: livepulse 2s infinite;
}
@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(93,156,106,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(93,156,106,0); }
  100% { box-shadow: 0 0 0 0 rgba(93,156,106,0); }
}

/* =====================
   HOME TABS
   ===================== */
.home-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  flex-wrap: wrap;
}
.home-tab {
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.home-tab:hover { background: var(--surface3); color: var(--text); }
.home-tab.active { background: var(--surface3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* =====================
   SECTION HEADER
   ===================== */
.section-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.section-title { font-size: 16px; font-weight: 700; color: var(--text); }
.section-count { font-size: 13px; color: var(--text3); }

/* =====================
   COMMUNITY GRID
   ===================== */
.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.community-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.community-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

.community-card-banner {
  height: 60px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 8px 10px;
}
.community-card-icon { font-size: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.community-card-body { padding: 10px 12px 12px; }
.community-card-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.community-card-desc {
  font-size: 12px; color: var(--text2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 10px;
}
.community-card-footer { display: flex; align-items: center; justify-content: space-between; }
.community-members { font-size: 11px; color: var(--text3); }

.join-btn {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.join-btn:hover, .join-btn.joined { background: var(--accent); color: #fff; border-color: var(--accent); }

.admin-delete-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.5);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  color: #fff;
  transition: var(--transition);
}
.admin-delete-btn:hover { background: var(--danger); }

.skeleton-card {
  height: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%,100% { opacity: .6; }
  50% { opacity: 1; }
}

/* =====================
   CREATE POST BAR
   ===================== */
.create-post-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.create-post-bar:hover { border-color: var(--accent); }

.user-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--surface3);
  flex-shrink: 0;
}

.fake-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface3);
  font-size: 14px;
  color: var(--text3);
  cursor: pointer;
}

/* =====================
   FILTER TABS
   ===================== */
.filter-tabs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}
.filter-btn:hover, .filter-btn.active { background: var(--surface3); color: var(--text); }

/* =====================
   POST FORM
   ===================== */
.post-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-form-header {
  background: linear-gradient(90deg, var(--accent) 0%, #b85c38 100%);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.post-form-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 2px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text2); }
.form-hint { font-size: 11px; color: var(--text3); }
.form-hint.warn { color: var(--warn); }
.form-hint-inline { font-size: 11px; color: var(--text3); font-weight: normal; }
.required { color: var(--accent); }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  font-size: 14px;
  background: var(--surface3);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.form-input::placeholder { color: var(--text3); }
.form-input:focus { border-color: var(--accent); background: var(--surface2); box-shadow: 0 0 0 2px var(--accent-bg); }

.form-textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  font-size: 14px;
  background: var(--surface3);
  color: var(--text);
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.form-textarea::placeholder { color: var(--text3); }
.form-textarea:focus { border-color: var(--accent); background: var(--surface2); box-shadow: 0 0 0 2px var(--accent-bg); }

.form-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.char-hint { font-size: 12px; color: var(--text3); }
.char-counter { font-size: 12px; color: var(--text3); }
.char-counter.warn { color: var(--warn); }
.char-counter.danger { color: var(--danger); font-weight: 700; }
.posting-as { font-size: 12px; color: var(--text2); }

/* =====================
   POST CARD
   ===================== */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}
.post-card:hover { border-color: var(--border2); box-shadow: 0 2px 12px rgba(0,0,0,.3); }
.post-card.pinned { border-left: 3px solid var(--accent); }

.vote-col {
  width: 44px;
  background: var(--surface2);
  border-radius: var(--radius) 0 0 var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  gap: 4px;
  flex-shrink: 0;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: var(--transition);
}
.vote-btn:hover { background: var(--surface3); }
.vote-btn.up:hover, .vote-btn.up.voted { color: var(--accent); }
.vote-btn.down:hover, .vote-btn.down.voted-down { color: var(--blue); }

.vote-score { font-size: 12px; font-weight: 700; color: var(--text2); }
.vote-score-lg { font-size: 18px; font-weight: 800; color: var(--accent); display: block; text-align: center; }
.vote-label { font-size: 10px; color: var(--text3); text-align: center; }

.post-content-col { flex: 1; padding: 10px 14px; min-width: 0; }

.post-meta {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.post-flair {
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 12px; margin-right: 2px; opacity: .9;
}
.post-sub-tag {
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 12px; margin-right: 4px; opacity: .85;
}

.post-author { color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; }
.post-author:hover { color: var(--accent); }

.post-dm-btn {
  display: inline-flex; align-items: center;
  font-size: 12px; margin-left: 4px; padding: 1px 5px;
  border-radius: 6px; text-decoration: none; opacity: 0;
  transition: opacity .15s;
}
.post-meta:hover .post-dm-btn,
.reply-meta:hover .post-dm-btn { opacity: .7; }
.post-dm-btn:hover { opacity: 1 !important; }

.pin-badge {
  font-size: 11px; color: var(--accent); font-weight: 700;
  margin-bottom: 6px; letter-spacing: .03em;
}

.post-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 10px;
  word-break: break-word;
  white-space: pre-wrap;
}
.removed-post { color: var(--text3); font-style: italic; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: var(--transition);
  -webkit-user-select: none;
  user-select: none;
}
.action-btn:hover { background: var(--surface3); color: var(--text); }
.action-btn.delete:hover { background: rgba(196,88,88,.15); color: var(--danger); }
.action-btn.block-btn:hover { background: rgba(196,88,88,.1); color: var(--danger); }

/* Awards */
.award-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.award-btn {
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface3);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text2);
}
.award-btn:hover { border-color: var(--accent); background: var(--accent-bg); }
.award-btn.has-awards { border-color: var(--border2); }
.award-btn.given { background: var(--accent-bg); border-color: var(--accent); }
.award-count { font-size: 11px; font-weight: 700; color: var(--text2); }

.hot-post-card { border-radius: var(--radius); }
.hot-post-text {
  font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================
   REPLY SECTION
   ===================== */
.reply-section { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; }
.replies {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 10px; padding-left: 12px; border-left: 2px solid var(--border2);
}
.reply-card { background: var(--surface2); border-radius: var(--radius); padding: 8px 12px; }
.reply-meta {
  font-size: 11px; color: var(--text3); margin-bottom: 5px;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.reply-author-link { font-weight: 600; color: var(--text2); cursor: pointer; }
.reply-author-link:hover { color: var(--accent); }
.reply-delete { margin-left: 4px; cursor: pointer; }
.reply-text { font-size: 13px; color: var(--text); line-height: 1.5; word-break: break-word; }

.reply-input-row { display: flex; gap: 8px; align-items: center; }
.reply-input-row input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  font-size: 13px;
  background: var(--surface3);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.reply-input-row input::placeholder { color: var(--text3); }
.reply-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }

/* =====================
   NEW POSTS BANNER
   ===================== */
.new-posts-banner {
  background: var(--accent); color: #fff;
  text-align: center; padding: 8px 16px;
  border-radius: var(--radius); font-size: 13px; font-weight: 700;
  cursor: pointer; display: none; transition: var(--transition);
}
.new-posts-banner:hover { background: var(--accent2); }

/* =====================
   POST SEARCH
   ===================== */
.post-search-wrap { position: relative; display: flex; align-items: center; }
.post-search-wrap input {
  width: 100%;
  padding: 8px 32px 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.post-search-wrap input::placeholder { color: var(--text3); }
.post-search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.post-search-clear {
  position: absolute; right: 10px;
  background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; display: none;
}

/* =====================
   BLOCKED BANNER
   ===================== */
.blocked-banner {
  background: rgba(196,88,88,.10);
  border: 1px solid rgba(196,88,88,.28);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 10px;
}

/* =====================
   EMPTY / LOADING
   ===================== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); font-size: 14px; line-height: 1.7; }
.loading-state { text-align: center; padding: 32px 20px; color: var(--text3); font-size: 14px; }

/* =====================
   SIDEBAR
   ===================== */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sidebar-card-banner {
  height: 56px;
  background: linear-gradient(135deg, #5a0a0a 0%, var(--accent) 100%);
}
.sidebar-card-body { padding: 14px; }
.sidebar-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.sidebar-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; }
.sidebar-meta { font-size: 12px; color: var(--text3); margin-top: 8px; }
.sidebar-stats { display: flex; gap: 20px; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 15px; font-weight: 700; color: var(--text); }
.stat span { font-size: 11px; color: var(--text3); }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.sidebar-section-title {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px;
}
.rules-list { padding-left: 18px; font-size: 13px; color: var(--text2); line-height: 1.9; }

.sidebar-nick-section { padding: 10px 0 4px; border-top: 1px solid var(--border); margin-top: 8px; }
.sidebar-nick-label { font-size: 11px; color: var(--text3); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sidebar-nick-display { font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================
   SUBREDDIT BANNER & HEADER
   ===================== */
.subreddit-banner { height: 90px; position: relative; }
.subreddit-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.55) 100%);
}
.subreddit-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.subreddit-icon-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  flex-shrink: 0;
}
.subreddit-info { flex: 1; min-width: 0; }
.subreddit-title { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.2; }
.subreddit-desc { font-size: 13px; color: var(--text2); margin-top: 2px; }
.subreddit-header-right { display: flex; align-items: center; gap: 8px; }
.member-count-label { font-size: 12px; color: var(--text3); }
.join-btn-main {
  padding: 7px 20px;
  border-radius: 20px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.join-btn-main:hover, .join-btn-main.joined { background: var(--accent); color: #fff; }

/* =====================
   MODAL
   ===================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.65);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close {
  cursor: pointer; color: var(--text3); font-size: 20px;
  line-height: 1; padding: 4px; border-radius: 4px; transition: var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--surface3); }
.modal-body {
  padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; flex: 1;
}
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

/* Create community modal */
.create-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.create-preview-banner {
  width: 64px; height: 64px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0;
}
.create-preview-name { font-size: 16px; font-weight: 700; color: var(--text); }

.icon-picker {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: var(--surface2); border-radius: var(--radius); border: 1px solid var(--border);
}
.icon-opt {
  font-size: 22px; padding: 4px; border-radius: var(--radius);
  cursor: pointer; border: 2px solid transparent; transition: var(--transition); line-height: 1;
}
.icon-opt:hover { background: var(--surface3); }
.icon-opt.sel { border-color: var(--accent); background: var(--accent-bg); }

.color-picker {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 8px;
  background: var(--surface2); border-radius: var(--radius); border: 1px solid var(--border);
}
.color-opt {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent; transition: var(--transition);
}
.color-opt:hover { transform: scale(1.15); }
.color-opt.sel { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-bg); }

.password-display {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface2);
  border-radius: var(--radius); border: 1px solid var(--border2);
}

/* =====================
   TOAST NOTIFICATIONS
   ===================== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  border: 1px solid var(--border2);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.35s ease;
  max-width: 320px;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }

/* =====================
   CHAT / MESSAGES PAGE
   ===================== */
.chat-body { background: var(--bg); }

.inbox-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.inbox-title { font-size: 20px; font-weight: 800; color: var(--text); }
.inbox-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }

.conversations-list { max-width: 700px; margin: 0 auto; padding: 8px 0; }

.convo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer;
  transition: var(--transition); border-bottom: 1px solid var(--border);
}
.convo-item:hover { background: var(--surface2); }
.convo-item.unread { background: rgba(212,112,74,.06); }
.convo-item.convo-blocked { opacity: .5; }

.convo-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0; border: 2px solid var(--border2);
}
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.convo-preview { font-size: 13px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.convo-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.convo-time { font-size: 11px; color: var(--text3); }
.convo-unread-badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.blocked-tag {
  font-size: 10px; background: rgba(196,88,88,.2); color: var(--danger);
  padding: 1px 6px; border-radius: 8px; font-weight: 700; margin-left: 4px;
}
.convo-block-btn {
  background: none; border: 1px solid var(--border); cursor: pointer;
  font-size: 14px; padding: 3px 7px; border-radius: 6px;
  color: var(--text3); transition: var(--transition); margin-top: 2px;
}
.convo-block-btn:hover { border-color: var(--danger); color: var(--danger); background: rgba(196,88,88,.1); }
.convo-block-btn.unblock:hover { border-color: var(--success); color: var(--success); }

.chat-view {
  display: flex; flex-direction: column;
  height: 100dvh; max-width: 760px; margin: 0 auto; background: var(--bg);
}
.chat-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: var(--nav-h);
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.chat-back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 20px; padding: 6px 8px;
  border-radius: var(--radius); transition: var(--transition); flex-shrink: 0;
}
.chat-back-btn:hover { background: var(--surface3); color: var(--text); }
.chat-header-info { display: flex; align-items: center; gap: 10px; flex: 1; text-decoration: none; }
.chat-recipient-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; border: 2px solid var(--border2); flex-shrink: 0;
}
.chat-recipient-name { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.chat-recipient-sub { font-size: 11px; color: var(--text3); }
.chat-header-text { min-width: 0; }

.chat-messages-list {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-day-label {
  text-align: center; font-size: 11px; color: var(--text3);
  font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin: 8px 0;
}
.chat-empty {
  display: none; flex-direction: column; align-items: center;
  gap: 8px; padding: 40px 20px; color: var(--text3); font-size: 14px; text-align: center;
}
.chat-empty-icon { font-size: 40px; }

.msg-bubble-wrap { display: flex; max-width: 78%; }
.msg-bubble-wrap.mine { margin-left: auto; }
.msg-bubble-wrap.theirs { margin-right: auto; }
.msg-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
}
.msg-bubble.mine { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs {
  background: var(--surface2); color: var(--text);
  border-bottom-left-radius: 4px; border: 1px solid var(--border);
}
.msg-time { font-size: 10px; opacity: .65; margin-top: 4px; text-align: right; }

.chat-input-bar {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.chat-input {
  flex: 1; padding: 10px 14px; border-radius: 20px;
  border: 1px solid var(--border2); background: var(--surface3);
  color: var(--text); font-size: 14px; outline: none; transition: var(--transition);
}
.chat-input::placeholder { color: var(--text3); }
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
}
.chat-send-btn:hover { background: var(--accent2); box-shadow: 0 2px 8px rgba(212,112,74,.4); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* =====================
   PROFILE PAGE
   ===================== */
.profile-page { max-width: 760px; margin: 0 auto; }
.profile-hero { padding: 32px 20px 24px; color: #fff; }
.profile-hero-inner {
  max-width: 700px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.profile-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; flex-shrink: 0; border: 3px solid rgba(255,255,255,.25);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.profile-name { font-size: 22px; font-weight: 800; color: #fff; }
.profile-you-badge {
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 12px; color: #fff;
}
.profile-anon-note { font-size: 13px; opacity: .7; margin-bottom: 10px; }
.profile-stats-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.profile-stat { display: flex; flex-direction: column; }
.profile-stat strong { font-size: 18px; font-weight: 700; }
.profile-stat span { font-size: 11px; opacity: .7; }
.profile-actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.profile-msg-btn { font-size: 13px; }

.btn-block-user {
  padding: 7px 16px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.3);
  background: transparent; color: rgba(255,255,255,.8);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-block-user:hover { border-color: var(--danger); color: #fff; background: rgba(196,88,88,.3); }
.btn-block-user.blocked { border-color: var(--success); color: #fff; background: rgba(93,156,106,.25); }

.profile-tabs-wrap {
  padding: 10px 20px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.profile-section { padding: 16px; }

.profile-post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: var(--transition);
}
.profile-post-card:hover { border-color: var(--border2); box-shadow: 0 2px 10px rgba(0,0,0,.3); }

.profile-post-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text3); margin-bottom: 8px;
}
.profile-comment-label {
  background: var(--surface3); color: var(--text2);
  font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.profile-ts { color: var(--text3); font-size: 11px; }
.profile-post-text { font-size: 14px; color: var(--text); line-height: 1.5; margin-bottom: 10px; }
.profile-post-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text3);
}
.profile-view-link { color: var(--accent); font-weight: 600; }

/* =====================
   FAB
   ===================== */
.fab {
  display: none;
  position: fixed; bottom: 24px; right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 24px; font-weight: 300; cursor: pointer;
  box-shadow: 0 4px 16px rgba(212,112,74,.5);
  align-items: center; justify-content: center;
  z-index: 300; transition: var(--transition);
}
.fab:hover { background: var(--accent2); transform: scale(1.08); }

/* =====================
   RESPONSIVE — Tablet (≤900px)
   ===================== */
@media (max-width: 900px) {
  .sidebar-col { display: none; }
  .page-layout { padding: 0 12px; }
  .community-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* =====================
   RESPONSIVE — Mobile (≤600px)
   ===================== */
@media (max-width: 600px) {
  :root { --nav-h: 48px; }

  .navbar { padding: 0 12px; gap: 8px; }
  .nav-brand { font-size: 14px; }
  .nav-center { display: none; }

  .home-hero { padding: 28px 16px 24px; }
  .home-hero-title { font-size: 22px; }
  .home-hero-sub { font-size: 14px; }

  .page-layout { margin: 12px auto; padding: 0 10px; }

  .community-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .home-tabs { gap: 2px; padding: 4px; }
  .home-tab { padding: 6px 10px; font-size: 12px; }

  .post-card { border-radius: 4px; }
  .vote-col { width: 36px; }

  .filter-tabs { gap: 4px; padding: 6px; }
  .filter-btn { padding: 5px 10px; font-size: 12px; }

  .fab { display: flex; }

  .btn-ghost { padding: 6px 10px; font-size: 12px; }
  .btn-primary { padding: 7px 14px; font-size: 13px; }

  .profile-hero-inner { gap: 14px; }
  .profile-avatar { width: 60px; height: 60px; font-size: 30px; }
  .profile-name { font-size: 18px; }
  .profile-stats-row { gap: 16px; }

  .msg-bubble-wrap { max-width: 88%; }

  .subreddit-header { padding: 10px 14px; }
  .subreddit-icon-circle { width: 44px; height: 44px; font-size: 22px; }
  .subreddit-title { font-size: 17px; }

  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .toast-container { bottom: 16px; right: 10px; left: 10px; }
  .toast { max-width: 100%; }

  .conversations-list { padding: 0; }
  .convo-item { padding: 10px 14px; }

  .pwa-install-banner { flex-wrap: wrap; gap: 8px; }
}

/* =====================
   RESPONSIVE — Very small (≤380px)
   ===================== */
@media (max-width: 380px) {
  .community-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-hero-title { font-size: 20px; }
  .nav-brand { display: none; }
  .home-tab { padding: 5px 8px; font-size: 11px; }
}

/* =====================
   LANDSCAPE MOBILE
   ===================== */
@media (max-height: 500px) and (orientation: landscape) {
  .home-hero { padding: 16px 20px; }
  .home-hero-icon { font-size: 32px; margin-bottom: 6px; }
  .home-hero-title { font-size: 20px; }
  .chat-view { height: 100dvh; }
  .chat-messages-list { padding: 8px; }
}

/* =====================
   LARGE SCREENS (≥1200px)
   ===================== */
@media (min-width: 1200px) {
  .page-layout { max-width: 1200px; }
  .community-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
