:root {
  --bg: #0e1117;
  --bg-card: #161b22;
  --bg-hover: #1f2937;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --orange: #ff4500;
  --blue: #58a6ff;
  --green: #3fb950;
  --radius: 6px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 100; }
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.logo { font-size: 22px; font-weight: 700; color: var(--orange); text-decoration: none; }
.search-bar { flex: 1; max-width: 400px; }
.search-bar input {
  width: 100%; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none;
}
.search-bar input:focus { border-color: var(--orange); }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-right .btn-sm { margin-left: 2px; }
#langSelect {
  padding: 6px 8px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 13px; cursor: pointer;
}
.user-name { font-weight: 600; color: var(--text); margin: 0 4px; }

/* Buttons */
.btn-sm {
  display: inline-block; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 6px 14px; border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: background 0.2s; text-decoration: none; user-select: none;
}
.btn-sm:hover { background: var(--bg-hover); }
.btn-primary {
  display: inline-block; background: var(--orange); color: white; border: none;
  padding: 8px 20px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
  font-weight: 600; transition: opacity 0.2s; text-align: center; user-select: none;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  display: inline-block; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 8px 20px; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; font-weight: 600; text-align: center; user-select: none;
}
.btn-danger { color: #f85149 !important; border-color: #f8514933 !important; }
.btn-danger:hover { background: #f8514922 !important; }
.btn-back { display: inline-block; margin-bottom: 16px; color: var(--blue); cursor: pointer; font-size: 14px; }
.btn-verify { color: var(--orange) !important; border-color: var(--orange) !important; }

/* Layout */
.layout { max-width: 1100px; margin: 0 auto; display: flex; gap: 20px; padding: 16px; }
.sidebar { width: 280px; flex-shrink: 0; }
.main-content { flex: 1; min-width: 0; }
.sidebar-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px;
}
.sidebar-card h3 { font-size: 14px; margin-bottom: 8px; }
.sidebar-card p { font-size: 13px; color: var(--text-muted); }
.powered { font-size: 12px; color: var(--text-muted); text-align: center; }
.sub-list { display: flex; flex-direction: column; gap: 4px; }
.sub-item { padding: 6px 8px; border-radius: 4px; cursor: pointer; color: var(--text); font-size: 13px; }
.sub-item:hover { background: var(--bg-hover); }
.sub-item.active { background: var(--bg-hover); color: var(--orange); font-weight: 600; }
.verify-banner { background: #ff450022; border: 1px solid #ff450044; border-radius: var(--radius); padding: 10px; font-size: 13px; color: var(--orange); margin-bottom: 12px; }

/* Sort tabs */
.sort-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.sort-tabs button {
  padding: 6px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 600;
}
.sort-tabs button.active { background: var(--orange); color: white; border-color: var(--orange); }

/* Post card */
.post-card {
  display: flex; gap: 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.2s;
}
.post-card:hover { border-color: var(--text-muted); }
.vote-col { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 40px; }
.vote-col-sm { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 36px; margin-right: 8px; }
.vote-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 2px; }
.vote-btn:hover { color: var(--orange); }
.score { font-weight: 700; font-size: 13px; }
.score-sm { font-weight: 600; font-size: 12px; }
.post-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.post-title { font-size: 16px; margin-bottom: 4px; }
.post-content { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.post-content-full { font-size: 14px; line-height: 1.6; margin: 8px 0; white-space: pre-wrap; }
.post-link { font-size: 13px; color: var(--blue); }

/* Post detail */
.post-detail { display: flex; gap: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.post-detail h2 { font-size: 20px; margin-bottom: 8px; }

/* Comments */
.comment-section { margin-top: 16px; }
.comment-section h3 { font-size: 16px; margin-bottom: 12px; }
.comment-form { margin-bottom: 16px; }
.comment-form textarea { width: 100%; padding: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; resize: vertical; min-height: 80px; }
.comments-list { display: flex; flex-direction: column; gap: 8px; }
.comment { display: flex; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.comment-text { font-size: 14px; }
.comment-main { flex: 1; }
.comment-actions { display: flex; gap: 12px; margin-top: 6px; }
.comment-action { font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none; }
.comment-action:hover { color: var(--orange); }
.reply-form { margin-top: 8px; }
.reply-list { margin-left: 20px; margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border); }
.comment-reply { margin-top: 8px; padding: 8px; background: var(--bg); border-radius: var(--radius); }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.auth-modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  width: 90%; max-width: 420px; max-height: 90vh; overflow-y: auto;
}
.auth-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.auth-modal-header h2 { font-size: 18px; }
.modal-close { cursor: pointer; font-size: 18px; color: var(--text-muted); }
.modal-close:hover { color: var(--text); }
.auth-modal-body { padding: 20px; }
.auth-form-group { margin-bottom: 14px; }
.auth-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.auth-form-group input, .auth-form-group select, .auth-form-group textarea {
  width: 100%; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none;
}
.auth-form-group input:focus, .auth-form-group select:focus, .auth-form-group textarea:focus { border-color: var(--orange); }
.auth-error { color: #f85149; font-size: 13px; margin-bottom: 8px; min-height: 18px; }
.auth-success { color: var(--green); font-size: 13px; margin-bottom: 8px; min-height: 18px; }
.auth-submit { display: block; width: 100%; margin-top: 4px; }
.auth-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.auth-forgot { margin-top: 12px; font-size: 13px; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.password-wrap { position: relative; }
.toggle-pwd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 16px; }

/* Search page */
.search-page { padding: 0 8px; }
.search-tabs { display: flex; gap: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.search-tab { padding: 8px 16px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; user-select: none; }
.search-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.date-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 8px 0; }
.date-filter-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.date-filter-btn { padding: 4px 12px; cursor: pointer; font-size: 13px; border-radius: 16px; border: 1px solid var(--border); color: var(--text-muted); user-select: none; }
.date-filter-btn:hover { border-color: var(--orange); color: var(--orange); }
.date-filter-btn.active { background: var(--orange); color: white; border-color: var(--orange); }
.custom-date-range { display: flex; align-items: center; gap: 6px; margin-top: 8px; width: 100%; }
.custom-date-range input[type="date"] { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 13px; }
.custom-date-range span { font-size: 13px; color: var(--text-muted); }
.custom-date-range .btn-primary { padding: 4px 12px; font-size: 13px; }
.user-search-card { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg-card); }
.user-search-card:hover { border-color: var(--orange); }
.user-avatar { font-size: 24px; }
.user-search-name { font-weight: 600; font-size: 15px; }
.user-search-date { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px 0; flex-wrap: wrap; }
.page-btn, .page-num, .page-dots { padding: 6px 12px; border-radius: var(--radius); font-size: 13px; cursor: pointer; user-select: none; }
.page-btn { color: var(--orange); border: 1px solid var(--border); background: var(--bg-card); }
.page-btn:hover { background: var(--orange); color: white; }
.page-num { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); }
.page-num:hover { border-color: var(--orange); color: var(--orange); }
.page-num.active { background: var(--orange); color: white; border-color: var(--orange); font-weight: 600; }
.page-dots { color: var(--text-muted); cursor: default; }

/* Announcements */
.announcement-card { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: linear-gradient(135deg, #ff450011, #ff950011); border: 1px solid #ff450033; border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: border-color 0.2s; }
.announcement-card:hover { border-color: var(--orange); }
.ann-icon { font-size: 20px; }
.ann-title { font-weight: 600; font-size: 14px; flex: 1; }
.ann-date { font-size: 12px; color: var(--text-muted); }
.ann-detail-date { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.ann-detail-content { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.ann-admin-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Footer */
.site-footer { margin-top: 40px; padding: 20px 16px; border-top: 1px solid var(--border); text-align: center; }
.footer-inner { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.footer-inner a { color: var(--orange); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }

/* Empty */
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* Admin */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.admin-tab { padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; user-select: none; }
.admin-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card h3 { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { font-weight: 600; color: var(--text-muted); }
tr:hover { background: var(--bg-hover); }
.ban-badge { background: #f8514922; color: #f85149; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.ban-badge.ban-perm { background: #f8514933; }
.active-badge { background: #3fb95022; color: #3fb950; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.mute-badge { background: #ff950022; color: #ff9500; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.mute-badge.mute-perm { background: #ff950033; }
.admin-badge { background: var(--orange); color: white; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.ban-select { padding: 4px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 12px; margin-right: 4px; }
.btn-unban { color: #3fb950 !important; border-color: #3fb95033 !important; }
.btn-unmute { color: #ff9500 !important; border-color: #ff950033 !important; }
.batch-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.batch-row input { flex: 1; padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 13px; }

/* Notifications */
.notif-bell { position: relative; cursor: pointer; }
.notif-badge { position: absolute; top: -6px; right: -6px; background: #f85149; color: white; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.notif-item { padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-unread { background: rgba(255, 149, 0, 0.08); }
.notif-msg { font-size: 14px; }
.notif-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Media embeds */
.media-embed { margin: 12px 0; max-width: 100%; overflow: hidden; }

/* Back to top/bottom buttons */
.scroll-btns { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.scroll-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--orange); color: white; border: none; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.3); transition: opacity 0.2s, transform 0.2s; opacity: 0; pointer-events: none; }
.scroll-btn.visible { opacity: 1; pointer-events: auto; }
.scroll-btn:hover { transform: scale(1.1); }

/* Responsive */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .header-inner { flex-wrap: wrap; }
  .search-bar { order: 3; max-width: 100%; }
}
