:root {
    --bg-body: #e0ecf5;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f6fa;
    --bg-hover: #dce6f0;
    --bg-input: #ffffff;
    --border: #c8d4e0;
    --border-light: #dce4ec;
    --text: #1c1e21;
    --text-muted: #57606a;
    --text-dim: #8c959f;
    --accent: #2d88ff;
    --accent-hover: #1877f2;
    --accent-dim: rgba(45, 136, 255, 0.12);
    --upvote: #2d88ff;
    --downvote: #e4405f;
    --green: #45bd62;
    --red: #f02849;
    --radius: 4px;
    --radius-lg: 8px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg-body);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; padding-bottom: 2rem; }

a { color: var(--text-muted); text-decoration: none; }
a:hover { color: var(--text); }

/* Navbar */
.navbar {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 0;
    height: 48px;
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-brand i { color: var(--accent); font-size: 1.3rem; }

.navbar .nav-link {
    color: var(--text-muted) !important;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem !important;
    border-radius: 4px;
}

.navbar .nav-link:hover { color: var(--text) !important; background: var(--bg-hover); }

.navbar .dropdown-menu {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.navbar .dropdown-item {
    color: var(--text);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.navbar .dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.navbar .dropdown-divider { border-color: var(--border); }

/* Sort Bar */
.sort-bar {
    display: flex;
    gap: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.sort-tab {
    flex: 1;
    text-align: center;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-right: 1px solid var(--border);
}

.sort-tab:last-child { border-right: none; }

.sort-tab:hover { background: var(--bg-hover); color: var(--text); }

.sort-tab.active {
    background: var(--bg-hover);
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* Post Feed / Card */
.post-feed {
    display: flex;
    flex-direction: column;
}

.post-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s;
    overflow: hidden;
}

.post-card:hover { border-color: var(--border-light); }

/* Vote Column */
.post-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    min-width: 40px;
    gap: 2px;
}

.vote-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.85rem;
    border-radius: 2px;
    transition: all 0.1s;
    line-height: 1;
}

.vote-btn:hover { color: var(--accent); background: var(--accent-dim); }
.vote-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
}

/* Post Main */
.post-main {
    flex: 1;
    padding: 0.6rem 0.75rem;
    min-width: 0;
}

.post-meta-top {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.post-subreddit {
    color: var(--text);
    font-weight: 700;
    font-size: 0.75rem;
}

.post-subreddit:hover { text-decoration: underline; color: var(--text); }

.sub-icon { color: var(--accent); font-weight: 800; }

.post-author { color: var(--text-dim); }

.post-dot {
    color: var(--text-dim);
    font-weight: bold;
    flex-shrink: 0;
}

.post-pin { color: var(--green); }
.post-lock { color: #ffd700; }

.post-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0.15rem 0 0.3rem;
    color: var(--text);
    line-height: 1.3;
}

.post-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.post-action {
    color: var(--text-dim);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.1s;
}

.post-action:hover { background: var(--bg-hover); color: var(--text); }
.post-last-reply { color: var(--text-dim); }

.post-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    background: var(--bg-secondary);
    color: var(--text-dim);
    font-size: 1.5rem;
}

/* Feed Pagination */
.feed-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 1rem 0;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.page-btn:hover { background: var(--bg-hover); color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Empty Feed */
.empty-feed {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.empty-feed-icon { font-size: 3rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.empty-feed h3 { color: var(--text); margin-bottom: 0.25rem; }

/* Subreddit Banner */
.subreddit-banner {
    background: linear-gradient(135deg, var(--accent), #1877f2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.sub-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sub-icon-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    flex-shrink: 0;
}

.sub-banner-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.sub-prefix {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

.sub-banner-content p {
    color: rgba(255,255,255,0.85);
    margin: 0.15rem 0 0.4rem;
    font-size: 0.85rem;
}

.sub-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}

.sub-stats strong { color: #fff; }

.sub-actions .btn-primary {
    background: #fff;
    color: var(--accent);
    border: none;
    font-weight: 700;
    border-radius: 100px;
    padding: 0.5rem 1.25rem;
}

.sub-actions .btn-primary:hover {
    background: rgba(255,255,255,0.9);
    color: var(--accent);
    transform: none;
    box-shadow: none;
}

/* Reddit Post Page */
.rd-post-container {
    max-width: 740px;
}

.rd-post-header {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.rd-post-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-secondary);
    min-width: 40px;
    gap: 2px;
}

.rd-vote-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 3px 6px;
    font-size: 0.85rem;
    border-radius: 2px;
    transition: all 0.1s;
    line-height: 1;
}

.rd-vote-btn:hover:not(:disabled) { color: var(--accent); background: var(--accent-dim); }
.rd-vote-btn:disabled { opacity: 0.4; cursor: default; }
.rd-vote-btn.active-up { color: var(--upvote); }
.rd-vote-btn.active-down { color: var(--downvote); }

.rd-vote-score {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
}

.rd-vote-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
}

.bot-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #e91e63;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.bot-badge i {
    font-size: 0.6rem;
}

.rd-post-body {
    flex: 1;
    padding: 0.75rem 1rem;
}

.rd-post-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.rd-sub-tag {
    color: var(--text);
    font-weight: 700;
    font-size: 0.75rem;
}

.rd-sub-tag:hover { text-decoration: underline; color: var(--text); }
.rd-post-dot { color: var(--text-dim); font-weight: bold; }

.rd-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 100px;
}

.rd-badge.pin { background: rgba(70,209,96,0.15); color: var(--green); }
.rd-badge.lock { background: rgba(255,215,0,0.15); color: #ffd700; }
.rd-badge.admin { background: var(--accent-dim); color: var(--accent); }
.rd-badge.mod { background: rgba(70,209,96,0.15); color: var(--green); }
.rd-badge.bot { background: rgba(113,147,255,0.15); color: var(--downvote); }

.rd-post-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0.2rem 0 0.5rem;
    line-height: 1.3;
}

.rd-post-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.rd-post-content pre {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    overflow-x: auto;
    font-size: 0.82rem;
}

.rd-post-content img { max-width: 100%; border-radius: var(--radius-lg); }

.rd-post-footer {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    align-items: center;
}

.rd-post-footer span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 4px;
}

.rd-mod-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.1s;
}

.rd-mod-btn:hover { border-color: var(--border-light); color: var(--text); }
.rd-mod-btn.delete:hover { border-color: var(--red); color: var(--red); }
.rd-mod-btn.report-btn { color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.rd-mod-btn.report-btn:hover { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,0.1); }
.rd-mod-btn.follow-active { color: #2ecc71; border-color: rgba(46,204,113,0.3); }
.rd-mod-btn.follow-active:hover { border-color: #2ecc71; color: #2ecc71; background: rgba(46,204,113,0.1); }
.rd-mod-btn.fav-active { color: #f39c12; border-color: rgba(243,156,18,0.3); }
.rd-mod-btn.fav-active:hover { border-color: #f39c12; color: #f39c12; background: rgba(243,156,18,0.1); }
.online-dot { width:8px; height:8px; border-radius:50%; background:#2ecc71; display:inline-block; margin-right:4px; }
.online-dot.offline { background:#555; }
.blog-content img, .social-card img, .game-card img, .message-content img, .rd-comment-content img, .rd-post-content img { max-width:100%; height:auto; }
.forum-editor-content img { max-width:100%; height:auto; }
a img.rounded-circle { transition: opacity 0.15s; }
a:hover img.rounded-circle { opacity: 0.85; }
img[loading="lazy"] { content-visibility: auto; }
.news-card .card-title, .blog-card .card-title { color: var(--text); }
.store-card:hover, .blog-card:hover, .news-card:hover, .game-card:hover, .social-card:hover { transform: translateY(-2px); transition: transform 0.15s; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.sidebar-cat-item { word-break: break-word; }

/* Comment Form */
.rd-comment-form {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.rd-comment-as {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.rd-comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.rd-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    resize: vertical;
    transition: border-color 0.15s;
    font-family: inherit;
}

.rd-textarea:focus {
    outline: none;
    border-color: var(--text-dim);
}

.rd-textarea::placeholder { color: var(--text-dim); }

.rd-comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

/* Comments */
.rd-comment {
    margin-bottom: 0;
}

.rd-comment-thread {
    display: flex;
    padding: 0.25rem 0;
}

.rd-comment-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.35rem;
    min-width: 32px;
    gap: 0;
}

.rd-thread-line {
    flex: 1;
    width: 2px;
    background: var(--border);
    margin-top: 4px;
    border-radius: 1px;
}

.rd-comment-body {
    flex: 1;
    padding: 0.35rem 0.5rem 0.35rem 0;
}

.rd-comment-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}

.rd-comment-user {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
}

.rd-comment-user:hover { text-decoration: underline; color: var(--text); }

.rd-comment-time { color: var(--text-dim); }
.rd-comment-edited { color: var(--text-dim); font-style: italic; font-size: 0.68rem; }

.rd-comment-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.rd-comment-content pre {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    font-size: 0.78rem;
    overflow-x: auto;
}

.rd-comment-footer {
    font-size: 0.7rem;
}

.rd-no-comments {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.rd-login-prompt {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.rd-login-prompt a { color: var(--accent); font-weight: 600; }

/* Form elements */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    transition: border-color 0.15s;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    border-color: var(--text-dim);
    box-shadow: none;
    color: var(--text);
}

.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; }

.form-label, label {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-control:disabled, .form-control[readonly] {
    background: var(--bg-secondary);
    color: var(--text-dim);
    opacity: 0.8;
}

.input-group-text {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    border: none;
    font-weight: 700;
    border-radius: 100px;
    padding: 0.45rem 1.25rem;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    border-radius: 100px;
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text);
}

.btn-outline-primary {
    border-color: var(--accent);
    color: var(--accent);
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-outline-primary:hover {
    background: var(--accent);
    color: #fff;
}

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.78rem; }

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
}

.card-body, .card-text, .card-title, .card-body small, .card-body p {
    color: var(--text);
}

.card-body a:not(.btn) {
    color: var(--accent);
}

.card-body a:not(.btn):hover {
    color: var(--accent-hover);
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.list-group-item {
    background: var(--bg-primary);
    color: var(--text);
    border-color: var(--border);
}

.list-group-item-action:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.list-group-item.active {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
    border-left: 3px solid var(--accent);
}

/* Alerts */
.alert {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    font-size: 0.85rem;
}

.alert-danger { border-color: rgba(240,40,73,0.3); background: rgba(240,40,73,0.08); color: var(--red); }
.alert-success { border-color: rgba(69,189,98,0.3); background: rgba(69,189,98,0.08); color: var(--green); }
.alert-info { border-color: rgba(50,140,255,0.3); background: rgba(50,140,255,0.08); color: #328cff; }
.alert-warning { border-color: rgba(255,215,0,0.3); background: rgba(255,215,0,0.08); color: #ffd700; }

/* Tables */
.table { color: var(--text); }
.table th { border-bottom: 1px solid var(--border); font-size: 0.72rem; color: var(--text-muted); }
.table td { border-bottom: 1px solid rgba(52,53,54,0.5); }
.table-hover tbody tr:hover { background: var(--bg-hover); }

/* Breadcrumb */
.breadcrumb { background: transparent; padding: 0.5rem 0; font-size: 0.8rem; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-dim); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-dim); }

/* Badge */
.badge { font-weight: 600; border-radius: 4px; }

/* Kbd */
kbd {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    border-radius: 3px;
    padding: 0 4px;
}

/* Pagination Bootstrap overrides */
.pagination .page-link {
    background: var(--bg-primary);
    border-color: var(--border);
    color: var(--text-muted);
    border-radius: 4px;
}

.pagination .page-link:hover { background: var(--bg-hover); color: var(--text); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* Footer */
footer {
    background: var(--bg-primary) !important;
    border-top: 1px solid var(--border);
    padding: 1.5rem 0 !important;
    margin-top: auto !important;
}

footer, footer a, footer .text-muted { color: var(--text-dim) !important; }
footer a:hover { color: var(--text-muted) !important; }
footer hr { border-color: var(--border); }
footer h5, footer h6 { color: var(--text-muted); }
footer .text-light { color: var(--text-dim) !important; }

/* Admin overrides */
.admin-sidebar {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border);
}

.admin-sidebar .nav-link:hover, .admin-sidebar .nav-link.active {
    background: var(--bg-hover) !important;
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    padding: 0.5rem 1rem;
}

.nav-tabs .nav-link:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--text);
    background: transparent;
    border-bottom: 2px solid var(--accent);
}

.nav-tabs {
    border-bottom: 1px solid var(--border);
}

.bg-white { background: #ffffff !important; }
.bg-dark { background: #18191a !important; }

.text-muted { color: var(--text-muted) !important; }
.text-dim { color: var(--text-dim) !important; }
.bg-light { background: #f0f6fa !important; }
.text-dark { color: var(--text) !important; }
.text-white { color: #ffffff !important; }

/* Create topic page card */
.card.shadow { background: var(--bg-primary); border: 1px solid var(--border); }
.card-header.bg-primary {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border);
    color: var(--text) !important;
}

/* Login/Register cards */
.card.shadow .card-body {
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    .post-card { border-radius: 0; border-left: none; border-right: none; }
    .subreddit-banner { border-radius: 0; padding: 1rem; }
    .rd-post-header { border-radius: 0; border-left: none; border-right: none; }
}

/* Profile Page */
.profile-banner {
    position: relative;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    margin-top: -1rem;
}

.profile-banner-bg {
    height: 140px;
    background: linear-gradient(135deg, #2d88ff, #1877f2, #0a4da6);
    opacity: 0.6;
}

.profile-banner-content {
    padding: 0 0 1rem;
    margin-top: -60px;
}

.profile-header {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.profile-avatar {
    border-radius: 50%;
    border: 4px solid var(--bg-primary);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.profile-info {
    padding-bottom: 0.25rem;
}

.profile-username {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-badges {
    display: flex;
    gap: 4px;
    margin: 4px 0;
}

.profile-bio {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 4px 0;
    max-width: 500px;
}

.profile-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.profile-meta i {
    margin-right: 4px;
}

.profile-stats-row {
    display: flex;
    gap: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-right: 1px solid var(--border);
}

.stat-item:last-child {
    border-right: none;
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.profile-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-post-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.profile-post-card:hover {
    border-color: var(--border-light);
}

.profile-post-body {
    min-width: 0;
}

.profile-post-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-post-cat {
    color: var(--text);
    font-weight: 600;
    font-size: 0.72rem;
}

.profile-post-cat:hover {
    text-decoration: underline;
    color: var(--text);
}

.profile-post-dot {
    color: var(--text-dim);
    font-weight: bold;
}

.profile-post-time {
    color: var(--text-dim);
}

.profile-post-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0.2rem 0 0.3rem;
    line-height: 1.3;
}

.profile-post-excerpt {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
}

.profile-post-link {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.profile-post-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.profile-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dim);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.profile-empty i {
    color: var(--border-light);
}

.profile-empty p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.upload-zone i {
    font-size: 2.5rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 0.5rem;
}

.upload-zone p {
    color: var(--text-muted);
}

.upload-zone:hover i {
    color: var(--accent);
}

/* Index Page - Category Sections */
/* Slider */
.main-slider { border-radius: var(--radius-lg); overflow: hidden; }
.main-slider .carousel-inner { border-radius: var(--radius-lg); }
.main-slider .slider-img { width: 100%; height: 400px; object-fit: cover; }
.main-slider .carousel-caption { background: linear-gradient(transparent, rgba(0,0,0,0.7)); border-radius: 0; left: 0; right: 0; bottom: 0; padding: 2rem 1.5rem 1.5rem; text-align: left; }
.main-slider .carousel-caption h5 { color: #fff; font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.main-slider .carousel-caption p { color: rgba(255,255,255,0.85); font-size: 0.9rem; margin: 0; max-width: 600px; }
@media (max-width: 768px) { .main-slider .slider-img { height: 200px; } .main-slider .carousel-caption { padding: 1rem; } .main-slider .carousel-caption h5 { font-size: 1rem; } .main-slider .carousel-caption p { font-size: 0.78rem; } }
@media (min-width: 769px) and (max-width: 1200px) { .main-slider .slider-img { height: 300px; } }

.category-section {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.cat-header-icon {
    font-size: 1.1rem;
    opacity: 0.7;
}
.category-header .category-name {
    color: inherit;
}
.category-header .category-desc {
    opacity: 0.7;
}
.category-header .category-stat {
    opacity: 0.8;
}
.category-header .btn-primary {
    background: rgba(255,255,255,0.2);
    border: none;
    color: inherit;
}
.category-header .btn-primary:hover {
    background: rgba(255,255,255,0.3);
}

.category-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.category-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.category-name:hover {
    color: var(--accent);
}

.category-desc {
    font-size: 0.72rem;
    color: inherit;
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sort-pill {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 3px;
    color: inherit;
    opacity: 0.6;
    transition: all 0.15s;
}
.sort-pill:hover, .sort-pill.active {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}
.category-stat {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.category-view-all {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.category-view-all:hover {
    text-decoration: underline;
}

.category-topics {
    padding: 0;
}

.topic-row {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}

.topic-row:last-child {
    border-bottom: none;
}

.topic-row:hover {
    background: var(--bg-hover);
}

.topic-row-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    flex-shrink: 0;
    padding-right: 0.5rem;
}

.topic-vote-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.topic-vote-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.topic-row-main {
    flex: 1;
    min-width: 0;
}

.topic-row-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 1px;
}

.topic-row-title a {
    color: var(--text);
}

.topic-row-title a:hover {
    color: var(--accent);
}

.topic-pin { color: var(--green); font-size: 0.75rem; margin-right: 3px; }
.topic-lock { color: #ffd700; font-size: 0.75rem; margin-right: 3px; }

.topic-row-meta {
    font-size: 0.68rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.topic-row-author {
    color: var(--text-muted);
    font-weight: 500;
}

.topic-row-dot {
    color: var(--text-dim);
    font-weight: bold;
}

/* Sidebar */
.sidebar-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.sidebar-card-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    padding: 0.65rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.sidebar-card-body {
    padding: 0.75rem;
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.sidebar-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.sidebar-stat-label {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.sidebar-cat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text);
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}

.sidebar-cat-item:last-child {
    border-bottom: none;
}

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

.sidebar-cat-count {
    font-size: 0.72rem;
    color: var(--text-dim);
    background: var(--bg-hover);
    padding: 1px 8px;
    border-radius: 100px;
}

.forum-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.forum-editor-toolbar button {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1;
    min-width: 32px;
    text-align: center;
}
.forum-editor-toolbar button:hover,
.forum-editor-toolbar button.active {
    background: var(--bg-hover);
    color: var(--text);
}
.forum-editor-toolbar .sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
    display: inline-block;
}
.forum-editor-content {
    min-height: 120px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    transition: border-color 0.15s;
}
.forum-editor-content:focus {
    border-color: var(--accent);
}
.forum-editor-content.empty:before {
    content: attr(data-placeholder);
    color: var(--text-dim);
    pointer-events: none;
}
.forum-editor-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin: 8px 0;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-style: italic;
}
.forum-editor-content pre.editor-code {
    background: #1a1b1e;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 8px 0;
}
.forum-editor-content pre.editor-code code {
    color: #e4e6eb;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}
.forum-editor-content a {
    color: var(--accent);
    text-decoration: underline;
}
.forum-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 8px 0;
}
.forum-editor-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 12px 0 6px;
    color: var(--text);
}
.forum-editor-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 10px 0 4px;
    color: var(--text);
}
.forum-editor-content ul, .forum-editor-content ol {
    margin: 6px 0;
    padding-left: 24px;
}
.forum-editor-content li {
    margin: 2px 0;
}
.forum-editor-content s {
    text-decoration: line-through;
    color: var(--text-dim);
}
.forum-editor-preview {
    min-height: 120px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-top: none;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.forum-editor-btn-small .forum-editor-content {
    min-height: 80px;
}
.forum-editor-btn-small .forum-editor-toolbar button {
    padding: 2px 8px;
    font-size: 13px;
    min-width: 28px;
}

/* Messages */
.conversation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.conversation-item:hover {
    background: var(--bg-hover);
}
.conversation-link {
    flex: 1;
    min-width: 0;
    padding: 0.85rem 0 0.85rem 1rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
}
.conversation-item.unread {
    background: rgba(99,102,241,0.04);
}
.conversation-info {
    flex: 1;
    min-width: 0;
}
.conversation-subject {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.conversation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}
.conversation-preview {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 12px;
}
.conversation-time {
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
}

/* Message list */
.message-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
}
.message-item {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}
.message-item.own {
    flex-direction: row-reverse;
}
.message-avatar {
    flex-shrink: 0;
}
.message-bubble {
    max-width: 70%;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
}
.message-item.own .message-bubble {
    background: var(--accent);
    color: #fff;
}
.message-item.own .message-bubble a {
    color: #fff;
    text-decoration: underline;
}
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.82rem;
}
.message-item.own .message-header strong {
    color: rgba(255,255,255,0.9);
}
.message-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: 8px;
}
.message-item.own .message-time {
    color: rgba(255,255,255,0.6);
}
.message-content {
    line-height: 1.5;
}
.message-content p {
    margin-bottom: 4px;
}

/* Activity feed */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}
.activity-item {
    display: flex;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    align-items: flex-start;
}
.activity-item:hover {
    background: var(--bg-hover);
}
.activity-item:last-child {
    border-bottom: none;
}
.activity-icon {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    font-size: 0.85rem;
    margin-top: 2px;
}
.activity-content {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}
.activity-text {
    font-size: 0.78rem;
    color: var(--text-dim);
    display: block;
}
.activity-title {
    font-size: 0.82rem;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-time {
    font-size: 0.68rem;
    color: var(--text-dim);
    display: block;
    margin-top: 1px;
}

.rd-quote{background:#f0f4ff;border-left:4px solid #6366f1;padding:12px 16px;margin:10px 0;border-radius:0 8px 8px 0;font-style:italic;color:#444}
