:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --header-bg: #272b33;
  --border: #dfe3e8;
  --text: #1f2328;
  --muted: #656d76;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --tag-bg: #f3f4f6;
  --green: #1a7f37;
  --red: #cf222e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

header {
  background: var(--header-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #1b1e24;
}
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  gap: 16px;
}
.brand {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.brand span { color: #60a5fa; font-weight: 500; }
.search-box {
  flex: 1;
  max-width: 320px;
}
.search-box input {
  width: 100%;
  background: #343a46;
  border: 1px solid #444c5c;
  border-radius: 4px;
  padding: 5px 10px;
  color: #fff;
  font-size: 13px;
}
.search-box input::placeholder { color: #9ca3af; }
.nav-links { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.nav-links a { color: #d1d5db; font-size: 13.5px; }
.nav-links a:hover, .nav-links a.active { color: #fff; font-weight: 600; }

.sub-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  margin-bottom: 18px;
}
.sub-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.hubs-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.hub-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 3px;
}
.hub-btn:hover { color: var(--text); background: var(--tag-bg); }
.hub-btn.active { color: var(--accent-dark); font-weight: 600; background: #eff6ff; }
.sort-tabs { display: flex; gap: 8px; }
.sort-btn {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.sort-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 840px) {
  .grid { grid-template-columns: 1fr; }
  .search-box { display: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 22px;
  margin-bottom: 14px;
}
.author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.author-name { font-weight: 600; }
.badge-karma {
  font-size: 11px;
  background: #eaf5ec;
  color: var(--green);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.post-time { color: var(--muted); font-size: 12.5px; }
.post-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
  display: block;
}
.hubs-line {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.hubs-line span { margin-right: 8px; }
.post-lead { font-size: 14.5px; color: #2b3038; margin-bottom: 12px; }
.code-snippet {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: #24292f;
  margin-bottom: 12px;
  overflow-x: auto;
}
.btn-read {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  padding: 5px 13px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}
.btn-read:hover { background: var(--accent); color: #fff; }

/* Interactive Reactions & Meta */
.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.react-chip {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2px 9px;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  user-select: none;
  transition: 0.12s;
}
.react-chip:hover { border-color: #b6bec8; background: #ebedf0; }
.react-chip.picked {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #eef0f3;
  font-size: 13px;
  color: var(--muted);
}
.meta-left { display: flex; align-items: center; gap: 16px; }
.vote-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
}
.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  padding: 0 3px;
}
.vote-btn:hover { color: var(--text); }
.vote-btn.up-active { color: var(--green); font-weight: 700; }
.vote-btn.down-active { color: var(--red); font-weight: 700; }
.vote-val { font-weight: 700; font-size: 13px; color: var(--green); }
.vote-val.neg { color: var(--red); }

.bm-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bm-btn.saved { color: #d97706; font-weight: 600; }

/* Sidebar */
.side-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}
.side-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}
.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
}
.side-list { list-style: none; }
.side-list li {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 13px;
}
.side-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.side-list a { font-weight: 500; display: block; line-height: 1.35; }
.side-stat { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.live-feed li { font-size: 12.5px; line-height: 1.4; }
.live-feed b { color: var(--text); }

/* Post Page & Comments */
.article-body p { margin-bottom: 14px; }
.article-body h3 { font-size: 17px; margin: 18px 0 8px; }
.comment {
  border-left: 2px solid #dfe3e8;
  padding-left: 14px;
  margin-bottom: 16px;
}
.comment.reply { margin-left: 24px; }
.comment-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.comment-head b { color: var(--text); }
.comment-like {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--muted);
}
.comment-like.liked { border-color: var(--green); color: var(--green); background: #eaf5ec; font-weight: 600; }

/* Auth & Queue */
.auth-box {
  max-width: 440px;
  margin: 30px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
}
.auth-box h1 { font-size: 18px; margin-bottom: 14px; }
.fg { margin-bottom: 12px; }
.fg label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.fg input, .fg textarea {
  width: 100%;
  border: 1px solid #cfd5df;
  border-radius: 3px;
  padding: 8px 10px;
  font: inherit;
}
.fg textarea { min-height: 70px; resize: vertical; }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
  display: block;
  text-align: center;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.err-alert {
  margin-top: 12px;
  padding: 10px;
  background: #ffebe9;
  border: 1px solid #ff8182;
  color: var(--red);
  border-radius: 3px;
  font-size: 13px;
  display: none;
}
.timer-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  background: #f6f8fa;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.mod-log {
  list-style: none;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 12.5px;
  max-height: 220px;
  overflow-y: auto;
}
.mod-log li { padding: 5px 0; border-bottom: 1px dashed #d8dee4; color: #424a53; }
.mod-log li:last-child { border-bottom: none; }
.verdict-box {
  margin-top: 14px;
  padding: 12px;
  background: #ffebe9;
  border: 1px solid #ff8182;
  border-radius: 4px;
  font-size: 13px;
  display: none;
}
.verdict-box strong { color: var(--red); display: block; margin-bottom: 4px; }

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
  padding: 18px 0;
  font-size: 12.5px;
  color: var(--muted);
}
