/* ============================================================
   The Burghs — single stylesheet
   Order: tokens → reset → primitives → layout → components → responsive
   ============================================================ */

:root {
  /* Surfaces & text */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --surface-muted: #f4f4f4;
  --surface-muted-hover: #ececec;
  --surface-active: #f0f0f0;
  --border: #ececec;
  --border-strong: #d4d4d4;
  --text: #0a0a0a;
  --text-hover: #2a2a2a;
  --text-muted: #707070;
  --text-faint: #a0a0a0;
  --nav-bg: rgba(255,255,255,0.85);

  /* Vote semantics (post / comment) */
  --vote-up: #2563eb;
  --vote-down: #dc2626;

  /* Prediction semantics (yes/no) */
  --yes: #16a34a;
  --yes-bg: #f0fdf4;
  --yes-border: #bbf7d0;
  --yes-divider: #d1fae5;
  --yes-hover: #dcfce7;
  --no: #dc2626;
  --no-bg: #fef2f2;
  --no-border: #fecaca;
  --no-hover: #fee2e2;

  /* Badges */
  --badge-bg: #f0f0f0;
  --badge-verified-bg: #e8f0ff;
  --badge-verified-fg: #1e40af;
  --badge-pinned-bg: #fef3c7;
  --badge-pinned-fg: #92400e;
  --badge-council-bg: #f3e8ff;
  --badge-council-fg: #6b21a8;

  /* Radii */
  --r-pill: 999px;
  --r-card: 12px;
  --r-md: 10px;
  --r-sm: 8px;
  --r-xs: 6px;
  --r-2xs: 4px;
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input { font-family: inherit; }
svg { display: block; }
.ico-stroke { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ===== TOP NAV ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  color: var(--text);
}
.logo-mark {
  width: 24px; height: 24px;
  flex-shrink: 0;
}
.logo-mark svg { width: 100%; height: 100%; }
.logo .the {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 14px;
}

.section-tabs { display: flex; gap: 2px; }
.section-tab {
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: all 0.15s;
  white-space: nowrap;
}
.section-tab:hover { background: var(--surface-muted); color: var(--text); }
.section-tab.active { background: var(--surface-active); color: var(--text); }

.search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  border-radius: var(--r-sm);
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.15s;
}
.search input:focus { background: var(--surface); border-color: var(--border-strong); }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }

.btn-primary {
  height: 36px;
  padding: 0 14px;
  background: var(--text);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--text-hover); }

.avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #d4d4d4, #a0a0a0);
  display: inline-block;
  flex-shrink: 0;
}

/* ===== PAGE HEADER (predictions, etc.) ===== */
.page-header {
  border-bottom: 1px solid var(--border);
  padding: 40px 24px 32px;
  background: var(--surface-hover);
}
.page-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 8px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 60ch;
}
.page-stats { display: flex; gap: 32px; }
.stat-num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ===== LAYOUT ===== */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 24px;
  padding: 24px;
}
.layout.narrow { grid-template-columns: 220px 1fr 300px; }

.sidebar, .right-col {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar::-webkit-scrollbar,
.right-col::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb,
.right-col::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== LEFT SIDEBAR NAV ===== */
.nav-section { margin-bottom: 20px; }
.nav-label, .sidebar h4 {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 6px 10px;
  margin-bottom: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-muted);
  transition: all 0.12s;
  cursor: pointer;
}
.nav-link:hover { background: var(--surface-muted); color: var(--text); }
.nav-link.active { background: var(--surface-active); color: var(--text); font-weight: 500; }
.nav-link .ico { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }
.nav-link .dot {
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #e8e8e8, #c4c4c4);
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.nav-link .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ===== MAIN FEED HEADER (sort + view controls) ===== */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}
.sort-tabs, .filter-tabs {
  display: flex; gap: 2px;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: var(--r-sm);
}
.sort-tab, .filter-tab {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.sort-tab.active, .filter-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.view-controls { display: flex; gap: 4px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== COMPOSE BOX ===== */
.compose {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.compose input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-size: 13px;
  outline: none;
}
.compose-actions { display: flex; gap: 4px; }
.compose-actions button {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.compose-actions button:hover { color: var(--text); border-color: var(--border-strong); }

/* ===== POST CARD ===== */
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  margin-bottom: 12px;
  padding: 16px 18px;
  transition: border-color 0.15s;
}
.post:hover { border-color: var(--border-strong); }

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.post-meta .sep, .pred-meta .sep { color: var(--text-faint); }
.post-meta .author { color: var(--text-muted); }

.burgh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 500;
}
.burgh-pill .burgh-icon {
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #d4d4d4, #888);
  flex-shrink: 0;
}

.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--r-2xs);
  background: var(--badge-bg);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge.verified { background: var(--badge-verified-bg); color: var(--badge-verified-fg); }
.badge.pinned   { background: var(--badge-pinned-bg);   color: var(--badge-pinned-fg); }
.badge.council  { background: var(--badge-council-bg);  color: var(--badge-council-fg); }
.badge.ai       { background: #fef3c7; color: #92400e; }

.post-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--text);
}
.post-title a:hover { color: var(--text-hover); }
.post-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
}
.post-body p + p { margin-top: 0.65em; }

.post-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  overflow: hidden;
  position: relative;
}
.post-image.gradient-1 { background: linear-gradient(135deg, #fafafa 0%, #e8e8e8 50%, #d0d0d0 100%); }
.post-image.gradient-2 { background: linear-gradient(120deg, #f5f5f5, #d4d4d4); }
.post-image.gradient-3 {
  background:
    radial-gradient(circle at 30% 40%, #e8e8e8 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, #d0d0d0 0%, transparent 50%),
    #f4f4f4;
}
.post-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.post-image .img-label {
  position: absolute;
  bottom: 12px; left: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--r-2xs);
  font-size: 11px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.post-link-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
}
.post-link-card:hover { background: var(--surface-hover); }
.post-link-card .favicon {
  width: 32px; height: 32px;
  background: var(--surface-active);
  border-radius: var(--r-xs);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
}
.post-link-card .lc-title { font-weight: 500; font-size: 13.5px; margin-bottom: 2px; }
.post-link-card .lc-url { font-size: 12px; color: var(--text-faint); }

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ===== VOTE GROUP (post/comment) ===== */
.vote-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface-muted);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.vote-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.vote-btn:hover { background: var(--surface); color: var(--text); }
.vote-btn.up:hover { color: var(--vote-up); }
.vote-btn.down:hover { color: var(--vote-down); }
.vote-btn.up.active   { color: var(--vote-up);   background: var(--surface); }
.vote-btn.down.active { color: var(--vote-down); background: var(--surface); }
.vote-count {
  min-width: 32px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

.action-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.action-btn:hover { background: var(--surface-muted-hover); color: var(--text); }
.action-btn.active { color: var(--text); }
.action-btn svg { width: 14px; height: 14px; }

/* ===== PANEL (right rail) ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  margin-bottom: 12px;
}
.panel h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* Charter panel */
.charter { background: linear-gradient(180deg, var(--surface-hover), var(--surface)); }
.charter h3 {
  color: var(--text);
  font-size: 13px;
  letter-spacing: -0.01em;
  text-transform: none;
  font-weight: 600;
  margin-bottom: 4px;
}
.charter .charter-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-style: italic;
}
.charter ul { list-style: none; }
.charter li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.charter li:last-child { border-bottom: none; }
.charter .check {
  width: 16px; height: 16px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Trending burghs panel */
.burgh-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.burgh-item:last-child { border-bottom: none; }
.burgh-item .burgh-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #d4d4d4, #888);
  flex-shrink: 0;
}
.burgh-item .burgh-name { font-size: 13.5px; font-weight: 500; }
.burgh-item .burgh-stat { font-size: 11.5px; color: var(--text-muted); }
.burgh-item .join-btn {
  margin-left: auto;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
}
.burgh-item .join-btn:hover { background: var(--text); color: #fff; border-color: var(--text); }
.burgh-item .join-btn.joined { background: var(--surface-muted); color: var(--text-muted); border-color: var(--border); }
.burgh-item .join-btn.joined:hover { background: var(--surface-muted-hover); color: var(--text); }

/* The single ad slot */
.ad-tiny {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: center;
}
.ad-tiny .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.ad-tiny .ad-content { font-size: 13px; line-height: 1.4; color: var(--text-muted); }
.ad-tiny .ad-content strong { color: var(--text); font-weight: 600; }

.footer-mini {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.7;
  padding: 0 4px;
}
.footer-mini a:hover { color: var(--text); }

/* ===== PREDICTION CARD ===== */
.pred {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.pred:hover { border-color: var(--border-strong); }

.pred-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pred-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--surface-muted);
  border-radius: 5px;
  color: var(--text);
  font-weight: 500;
  font-size: 12px;
}
.pred-category .cat-dot {
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--text-muted);
}
.pred-meta .deadline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pred-meta .deadline svg { width: 12px; height: 12px; }
.pred-meta .deadline.urgent { color: var(--no); font-weight: 500; }

.pred-question {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.pred-question a:hover { color: var(--text-hover); }
.pred-context {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.pred-bar { margin-bottom: 14px; }
.pred-bar-track {
  height: 36px;
  background: var(--no-bg);
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  position: relative;
  border: 1px solid var(--border);
}
.pred-bar-yes {
  background: var(--yes-bg);
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--yes);
  transition: width 0.4s ease;
  border-right: 1px solid var(--yes-divider);
  white-space: nowrap;
}
.pred-bar-no {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--no);
  white-space: nowrap;
}
.pred-bar-yes:empty, .pred-bar-no:empty { padding: 0; }

.pred-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vote-pair {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.vote-yes, .vote-no {
  flex: 1;
  height: 38px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
  border: 1px solid;
}
.vote-yes { background: var(--yes-bg); color: var(--yes); border-color: var(--yes-border); }
.vote-yes:hover { background: var(--yes-hover); }
.vote-yes.voted { background: var(--yes); color: #fff; border-color: var(--yes); }
.vote-no  { background: var(--no-bg); color: var(--no); border-color: var(--no-border); }
.vote-no:hover  { background: var(--no-hover); }
.vote-no.voted  { background: var(--no); color: #fff; border-color: var(--no); }

.pred-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-muted);
}
.pred-stats .stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pred-stats svg { width: 14px; height: 14px; }
.pred-stats .stat-item:hover { color: var(--text); cursor: pointer; }

.pred.resolved { opacity: 0.95; }
.resolved-banner {
  background: var(--yes-bg);
  color: var(--yes);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.pred.no-resolved .resolved-banner { background: var(--no-bg); color: var(--no); }

.pred-trend {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.pred-trend svg { height: 24px; }
.trend-info { display: flex; flex-direction: column; }
.trend-change { font-weight: 600; color: var(--text); font-size: 13px; }
.trend-change.up   { color: var(--yes); }
.trend-change.down { color: var(--no); }

/* Predictions right-rail panels */
.panel-cta { background: linear-gradient(180deg, var(--surface-hover), var(--surface)); }
.panel-cta .panel-headline {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.panel-cta p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.panel-cta .ask-btn, .new-prediction-btn {
  height: 36px;
  background: var(--text);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
}
.panel-cta .ask-btn { width: 100%; }
.panel-cta .ask-btn:hover, .new-prediction-btn:hover { background: var(--text-hover); }

.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.leader-row:last-child { border-bottom: none; }
.leader-rank {
  width: 22px;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.leader-name { flex: 1; font-weight: 500; }
.leader-score {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.leader-score.good { color: var(--yes); }

.closing-soon-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.closing-soon-item:last-child { border-bottom: none; }
.closing-soon-item .csi-q {
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 6px;
  font-weight: 500;
}
.closing-soon-item .csi-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}
.csi-yes { color: var(--yes); font-weight: 600; }
.csi-no  { color: var(--no);  font-weight: 600; }

.how-list { list-style: none; }
.how-list li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.45;
}
.how-list .num {
  width: 20px; height: 20px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== COMMENT THREAD ===== */
.comment-thread { display: flex; flex-direction: column; gap: 14px; }
.comment {
  display: flex;
  gap: 10px;
}
.comment .comment-body {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}
.comment .comment-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.comment .comment-meta .author { color: var(--text); font-weight: 500; }
.comment .comment-text { white-space: pre-wrap; }
.comment-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.comment-actions .vote-group { background: transparent; padding: 0; gap: 4px; }
.comment-actions .vote-btn { width: 24px; height: 24px; }
.comment-actions .vote-count { min-width: 24px; font-size: 12px; padding: 0; }
.comment-actions button.text-link { font-size: 12px; color: var(--text-muted); }
.comment-actions button.text-link:hover { color: var(--text); }
.comment-children {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.comment .removed-note {
  font-style: italic;
  color: var(--text-faint);
  font-size: 13px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-card);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .es-title { color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty-state .es-body { font-size: 13.5px; line-height: 1.5; max-width: 48ch; margin: 0 auto; }

/* ===== ERROR PAGE ===== */
.error-page { padding: 80px 24px; text-align: center; max-width: 600px; margin: 0 auto; }
.error-page .status { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.error-page h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 8px 0 12px; }
.error-page p { color: var(--text-muted); font-size: 15px; line-height: 1.55; margin-bottom: 24px; }

/* ===== LOAD MORE ===== */
.load-more {
  display: block;
  width: 100%;
  margin: 8px 0 24px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  transition: all 0.15s;
}
.load-more:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

/* ===== USER PROFILE ===== */
.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.profile-header .avatar.large {
  width: 64px; height: 64px;
}
.profile-header .ph-info { flex: 1; min-width: 200px; }
.profile-header .ph-name { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.profile-header .ph-handle { color: var(--text-muted); font-size: 14px; }
.profile-header .ph-bio { font-size: 14px; color: var(--text); line-height: 1.5; margin-top: 8px; }
.profile-header .ph-stats { display: flex; gap: 24px; }
.profile-header .ph-stats .stat-num { font-size: 18px; }

/* ===== CHARTER MODAL (first-visit only) ===== */
.charter-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: charter-fade-in 180ms ease-out;
}
.charter-modal.is-open { display: flex; }
.charter-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.charter-modal__card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: auto;
  padding: 28px 28px 22px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.16);
  animation: charter-slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.charter-modal__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.charter-modal__close:hover {
  background: var(--surface-muted);
  color: var(--text);
}
.charter-modal__card h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}
.charter-modal__sub {
  font-size: 13.5px;
  color: var(--text-muted);
  font-style: italic;
  margin: 4px 0 16px;
}
.charter-modal__card ul { list-style: none; }
.charter-modal__card li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.charter-modal__card li:last-child { border-bottom: none; }
.charter-modal__card .check {
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}
.charter-modal__cta {
  width: 100%;
  height: 40px;
  margin-top: 18px;
  background: var(--text);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.charter-modal__cta:hover { background: var(--text-hover); }

@keyframes charter-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes charter-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .charter-modal { padding: 16px; }
  .charter-modal__card { padding: 24px 22px 18px; }
}

/* Desktop already has the charter in the right rail, so suppress the modal
   above the breakpoint where the right column is visible. */
@media (min-width: 1101px) {
  .charter-modal,
  .charter-modal.is-open { display: none !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .layout, .layout.narrow { grid-template-columns: 220px 1fr; }
  .right-col { display: none; }
}
@media (max-width: 760px) {
  /* Safety net — never let any rogue child cause page-level horizontal scroll. */
  html, body { overflow-x: hidden; }

  .layout, .layout.narrow { grid-template-columns: 1fr; padding: 16px; }
  .sidebar { display: none; }
  .nav { padding: 0 12px; gap: 10px; }
  .search { display: none; }

  /* Let the tabs container shrink and scroll inside itself instead of
     pushing the whole nav wider than the viewport. */
  .section-tabs {
    flex: 1 1 0;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .section-tabs::-webkit-scrollbar { display: none; }
  .section-tab { flex-shrink: 0; }

  /* Tighter sign-in button on mobile so it doesn't crowd the tabs. */
  .nav-actions { gap: 6px; }
  .nav-actions .btn-primary { padding: 0 12px; font-size: 12.5px; }

  .page-header { padding: 24px 16px; }
  .page-title { font-size: 26px; }
  .page-stats { gap: 20px; }
}
