:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --border: #e6e6e8;
  --text: #1a1a1b;
  --text-dim: #767677;
  --accent: #ff8a24;
  --accent-dark: #e8720f;
  --upvote: #ff8a24;
  --downvote: #4a90d9;
  --radius: 10px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
}

.brand h1 span {
  color: var(--text);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
}

#search {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  width: 280px;
  max-width: 40vw;
  outline: none;
}

#search:focus { border-color: var(--accent); }

.post-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.post-btn:hover { background: var(--accent-dark); }

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 20px 12px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 22px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 12px 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.sidebar-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.sidebar-item .count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.sidebar-item:hover { background: var(--bg); }

.sidebar-item.active {
  background: #fff3e6;
  color: var(--accent-dark);
}

.sidebar-item.active .dot { background: var(--accent-dark); }

main {
  flex: 1;
  min-width: 0;
  padding: 20px 20px 60px;
  max-width: 680px;
  margin: 0 auto;
}

.feed-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.feed-tab {
  padding: 10px 2px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: default;
  border-bottom: 3px solid transparent;
}

.feed-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 6px;
}

.post-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  text-transform: uppercase;
}

.post-date {
  font-size: 12px;
  color: var(--text-dim);
}

.post-title {
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0 10px;
  padding: 0 14px;
  line-height: 1.35;
}

.post-media {
  width: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 620px;
  overflow: hidden;
  cursor: pointer;
}

.post-media img, .post-media video {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  display: block;
}

.post-caption {
  padding: 10px 14px 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.post-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px 14px;
}

.vote-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px 6px;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  color: var(--text-dim);
  padding: 0;
}

.vote-btn:hover { background: #eee; }
.vote-btn.up.voted { color: var(--upvote); }
.vote-btn.down.voted { color: var(--downvote); }

.vote-score {
  font-size: 13px;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}

.post-action:hover { background: var(--bg); }

.tag-chip {
  font-size: 11px;
  color: var(--accent-dark);
  background: #fff3e6;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.post-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 14px 12px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

.empty-state h2 { color: var(--text); margin-bottom: 8px; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.lightbox.open { display: flex; }

.lightbox-inner {
  max-width: 720px;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

.lightbox-inner img, .lightbox-inner video {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  background: #000;
  display: block;
}

.lightbox-meta { padding: 14px 18px; }
.lightbox-meta h3 { margin: 0 0 6px; font-size: 17px; }
.lightbox-meta p { margin: 0 0 10px; color: var(--text-dim); font-size: 14px; }

.close-btn {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}

footer.site-footer {
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
  font-size: 13px;
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  main { max-width: 100%; }
}
