/* UnyHub Custom Styles - Extracted from wireframe */

/* Alpine.js cloak: hide elements until Alpine initializes */
[x-cloak] {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffffef;
    --bg-secondary: #f2f3f5;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #eceef1;
    --hover-bg: rgba(0, 0, 0, 0.03);
    --primary-color: #18181b;
    --card-bg: #ffffff;
    --card-border: #edeff2;
    --input-bg: #ffffff;
    --page-bg: #ffffff;
    --card-radius: 16px;
    --card-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --card-shadow-hover: 0 6px 18px rgba(16, 24, 40, .10);
    --brand-gradient: linear-gradient(135deg, #dc2424 0%, #4a569d 100%);
    --comment-thread: #d9dbdf;
}

[data-theme='dark'] {
    --bg-primary: #15181c;
    --bg-secondary: #1a1e22;
    --text-primary: #f7f9f9;
    --text-secondary: #71767b;
    --border-color: #5c5e61;
    --hover-bg: #2a2c2d;
    --primary-color: #f7f9f9;
    --card-bg: #1a1e22;
    --card-border: #2f3336;
    --input-bg: #15181c;
    --page-bg: #0f1114;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --card-shadow-hover: 0 6px 18px rgba(0, 0, 0, .5);
    --comment-thread: #3a3d42;
}

/* Tailwind Overrides for Dark Mode */
[data-theme='dark'] .bg-white {
    background-color: var(--bg-primary) !important;
}

[data-theme='dark'] .bg-gray-50 {
    background-color: var(--bg-secondary) !important;
}

[data-theme='dark'] .text-gray-900 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .text-gray-800 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .text-gray-700 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .text-gray-600 {
    color: var(--text-secondary) !important;
}

[data-theme='dark'] .text-gray-500 {
    color: var(--text-secondary) !important;
}

[data-theme='dark'] .border-gray-100,
[data-theme='dark'] .border-gray-200 {
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .shadow-sm,
[data-theme='dark'] .shadow-md,
[data-theme='dark'] .shadow-lg {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

[data-theme='dark'] .sidebar-divider {
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .text-gray-400,
[data-theme='dark'] .text-gray-500 {
    color: var(--text-secondary) !important;
}

[data-theme='dark'] .text-gray-700,
[data-theme='dark'] .text-gray-800,
[data-theme='dark'] .text-gray-900 {
    color: var(--text-primary) !important;
}

/* Badge Dark Mode Overrides */
[data-theme='dark'] .bg-green-100 {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

[data-theme='dark'] .text-green-800 {
    color: #10b981 !important;
}

[data-theme='dark'] .bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

[data-theme='dark'] .text-blue-800 {
    color: #3b82f6 !important;
}

[data-theme='dark'] .bg-purple-100 {
    background-color: rgba(139, 92, 246, 0.1) !important;
}

[data-theme='dark'] .text-purple-800 {
    color: #8b5cf6 !important;
}

[data-theme='dark'] .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

[data-theme='dark'] .text-blue-700 {
    color: #3b82f6 !important;
}

/* Picker (Meme/Emoji) Refinements */
[data-theme='dark'] .absolute.bg-white {
    background-color: var(--bg-primary) !important;
}

[data-theme='dark'] .sticky.bg-white {
    background-color: var(--bg-primary) !important;
}

[data-theme='dark'] .hover\:bg-gray-100:hover {
    background-color: var(--hover-bg) !important;
}

[data-theme='dark'] .border-gray-200,
[data-theme='dark'] .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Follow Button and Empty States */
[data-theme='dark'] .bg-gray-200 {
    background-color: var(--bg-secondary) !important;
}

[data-theme='dark'] .text-gray-700 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .empty-state {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .text-primary,
[data-theme='dark'] .widget-title a.text-primary,
[data-theme='dark'] .widget-content a.text-primary,
[data-theme='dark'] .right-sidebar a:not(.post-btn):not(.follow-btn) {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Button Contrast Refinement (black buttons get the brand-gradient border
   instead — see the .post-btn / bg-primary rules below). */
[data-theme='dark'] .follow-btn,
[data-theme='dark'] button.bg-gray-200,
[data-theme='dark'] .appearance-card button {
    border: 1.5px solid white !important;
}

[data-theme='dark'] .leaderboard-item,
[data-theme='dark'] .trending-topic,
[data-theme='dark'] .community-item {
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme='dark'] .bg-white {
    background-color: var(--card-bg) !important;
}

[data-theme='dark'] .bg-gray-50 {
    background-color: var(--bg-secondary) !important;
}

[data-theme='dark'] .bg-gray-100 {
    background-color: var(--bg-secondary) !important;
}

[data-theme='dark'] .border-gray-100 {
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .border-gray-200 {
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .text-gray-900 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .text-gray-700 {
    color: var(--text-primary) !important;
}

[data-theme='dark'] .text-gray-600 {
    color: var(--text-secondary) !important;
}

[data-theme='dark'] .text-gray-500 {
    color: var(--text-secondary) !important;
}

/* Tailwind Hover Overrides for Dark Mode */
[data-theme='dark'] .hover\:bg-gray-50:hover,
[data-theme='dark'] .hover\:bg-gray-100:hover,
[data-theme='dark'] .hover\:bg-white:hover {
    background-color: var(--hover-bg) !important;
}

/* Remove explicit white borders from leaderboard if they exist */
[data-theme='dark'] .leaderboard-item {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--page-bg);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.app-container {
    display: flex;
    max-width: 100rem;
    margin: 0 auto;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    padding: 0 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-content {
    flex: 1;
}

.logo {
    margin-bottom: 20px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

/* Brand logo icon shown beside the wordmark */
.brand-logo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    margin-right: 8px;
}

.mobile-top-header__brand .brand-logo {
    width: 24px;
    height: 24px;
    margin-right: 6px;
}

/* Brand wordmark (Orbitron) — replaces the logo image everywhere */
.brand-wordmark {
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    font-size: 24px;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1;
}

.brand-wordmark--lg {
    font-size: 30px;
}



/* Responsive logo adjustments */
@media (max-width: 1200px) {
    .logo img {
        max-width: 140px;
    }
}

@media (max-width: 768px) {
    .logo img {
        max-width: 120px;
    }
}

.nav-item {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 8px 16px;
    margin-bottom: 2px;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 17px;
    position: relative;
}

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

.nav-item.active {
    font-weight: 700;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.badge {
    margin-left: 8px;
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.achievements-section {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid white;
}

.section-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.achievement-item {
    text-align: center;
    padding: 8px 4px;
    background: var(--card-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 54px;
}

.achievement-icon {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-icon .badge-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.achievement-icon .badge-icon::before {
    border-radius: 8px;
}

.achievement-icon .badge-icon svg {
    width: 20px;
    height: 20px;
}

.achievement-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-profile-section {
    margin-top: auto;
    padding: 12px;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-section:hover {
    background: var(--hover-bg);
}

.avatar-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    transform: translateY(-2px);
}

.points {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

.fire-icon {
    display: none;
    /* Hide old fire icons */
}

.reputation-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #eab308;
    border-radius: 50%;
    margin-right: 4px;
    box-shadow: 0 0 4px rgba(234, 179, 8, 0.5);
    vertical-align: middle;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .main-content {
        border-right: none;
    }
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    transform: translateY(-2px);
}

.user-info {
    flex: 1;
}

.username {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.user-handle {
    font-size: 14px;
    color: var(--text-secondary);
}

.reputation {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Feed Tabs */
.feed-tabs {
    display: flex;
    /* Solid, fully-opaque background (no backdrop-filter): a sticky element with
       backdrop-filter forces a GPU-composited layer that Chromium intermittently
       mis-paints on scroll/htmx-swap, clipping the top of the page. */
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
}

.tab {
    flex: 1;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 15px;
    text-align: center;
    color: var(--text-secondary);
    position: relative;
    background: none;
    border: none;
}

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

.tab.active {
    color: var(--text-primary);
    font-weight: 700;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    border-radius: 4px 4px 0 0;
}

/* Post Composer */
.post-composer {
    padding: 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.composer-header {
    display: flex;
    gap: 12px;
}

.compose-input {
    width: 100%;
    padding: 12px 0;
    border: none;
    outline: none;
    resize: none;
    min-height: 60px;
    font-family: inherit;
    font-size: 20px;
    color: #0f1419;
}

.compose-input::placeholder {
    color: #536471;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.composer-tools {
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 18px;
}

.tool-btn:hover {
    background: rgba(49, 47, 47, 0.1);
}

.post-btn {
    padding: 8px 20px;
    color: white;
    /* Brand-gradient border via double background + background-clip
       (keeps the black fill, works with the rounded corners). */
    border: 2px solid transparent;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    background-image: linear-gradient(#18181b, #18181b), var(--brand-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transition: background-image 0.2s, opacity 0.2s;
}

.post-btn:hover {
    background-image: linear-gradient(#000, #000), var(--brand-gradient);
}

.post-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Brand-gradient border on the other solid-black (bg-primary) buttons/links.
   Excludes the opacity-tinted variants (bg-primary bg-opacity-*), which aren't black. */
button.bg-primary:not([class*="bg-opacity"]),
a.bg-primary:not([class*="bg-opacity"]) {
    border: 2px solid transparent;
    background-image: linear-gradient(#18181b, #18181b), var(--brand-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* Post Card */
.post-card {
    padding: 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

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

.post-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 40px;
}

.vote-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.vote-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.vote-btn.upvote.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-primary);
}

.vote-btn.downvote.active {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
    color: var(--bg-primary);
}

.vote-btn.downvote:hover {
    background: rgba(107, 114, 128, 0.1);
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.vote-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    min-height: 18px;
}

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

.post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
    position: relative;
    padding-right: 32px;
}

/* Pin the ⋯ menu to the top-right so long meta text wraps underneath it
   instead of pushing the button onto a new line. */
.post-header-menu {
    position: absolute;
    top: 0;
    right: 0;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    transform: translateY(-2px);
}

.author-name {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Post heading (optional larger bold title above content) */
.post-heading {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

/* Heading input in the create/edit composer */
.compose-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Gradient focus border for inputs (replaces the default black focus border/outline) */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):focus,
textarea:focus,
select:focus,
.toastui-editor-defaultUI:focus-within {
    outline: none !important;
    border: 2px solid transparent !important;
    background-image: linear-gradient(var(--input-bg), var(--input-bg)), var(--brand-gradient) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    box-shadow: none !important;
}

/* Composer action popups centered at the top on mobile; smaller create/edit inputs */
@media (max-width: 768px) {
    .composer-popup {
        position: fixed !important;
        top: 64px;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        width: 92vw !important;
        max-width: 92vw !important;
        margin-top: 0 !important;
    }

    .compose-input {
        font-size: 16px !important;
    }

    .compose-heading {
        font-size: 16px !important;
    }
}

.author-name strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.author-name strong:hover {
    text-decoration: underline;
}

.role-badge {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.role-badge.moderator {
    background: #8b5cf6;
}

.author-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.community-tag {
    color: var(--primary-color);
    font-weight: 500;
}

.community-tag:hover {
    text-decoration: underline;
}

.meta-separator {
    color: var(--text-secondary);
}

.more-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.more-btn:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.post-content {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 15px;
    color: var(--text-primary);
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.post-image {
    width: 100%;
    max-height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    overflow: hidden;
}

.read-more {
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 400;
}

.read-more:hover {
    text-decoration: underline;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    max-width: 425px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #536471;
    transition: all 0.2s;
}

.action-btn:hover {
    color: #312f2f;
}

.action-btn:hover .action-icon-wrapper {
    background: rgba(49, 47, 47, 0.1);
}

.action-btn.comment:hover {
    color: #1d9bf0;
}

.action-btn.comment:hover .action-icon-wrapper {
    background: rgba(29, 155, 240, 0.1);
}

.action-btn.like.active {
    color: #ef4444;
}

.action-btn.like.active .action-icon-wrapper {
    background: rgba(239, 68, 68, 0.1);
}

.action-btn.bookmark.active {
    color: #1d9bf0;
}

.action-btn.bookmark.active .action-icon-wrapper {
    background: rgba(29, 155, 240, 0.1);
}

.action-icon-wrapper {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.action-icon {
    font-size: 18px;
}

/* SVG Icons */
.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
}

/* Right Sidebar */
.right-sidebar {
    width: 350px;
    padding: 20px 20px 20px 32px;
    margin-left: auto;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.right-sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.right-sidebar {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.search-container {
    position: sticky;
    top: 0;
    /* background: var(--bg-primary); */
    padding-bottom: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-bar {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

.search-bar:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

.search-bar::placeholder {
    color: var(--text-secondary);
}

.widget {
    background: var(--bg-secondary);
    padding: 0;
    border-radius: var(--card-radius);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.widget-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    padding: 14px 16px 10px 16px;
}

.widget-content {
    padding: 10px;
}

a.trending-topic-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.trending-topic {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.topic-title {
    font-weight: 700;
    margin-bottom: 1px;
    font-size: 13px;
    color: var(--text-primary);
}

.topic-count {
    font-size: 11px;
    color: var(--text-secondary);
}

.community-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.community-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.join-btn {
    padding: 4px 12px;
    background: #0f1419;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.2s;
}

.join-btn:hover {
    background: #2f3336;
}

.leaderboard-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

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

.rank {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 24px;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1000px) {
    .right-sidebar {
        display: none;
    }

    .main-content {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 68px;
        padding: 4px;
    }

    .nav-item span:not(.nav-icon),
    .achievements-section,
    .user-info {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .user-profile-section {
        padding: 12px;
        justify-content: center;
    }

    /* The mobile drawer is a full sidebar, not the collapsed icon rail:
       keep labels (text is priority), left-aligned, with icon when it fits. */
    .mobile-drawer .nav-item span:not(.nav-icon),
    .mobile-drawer .user-info {
        display: block;
    }

    .mobile-drawer .nav-item {
        justify-content: flex-start;
        padding: 10px 16px;
    }

    .mobile-drawer .user-profile-section {
        justify-content: flex-start;
    }

    .main-content {
        margin-left: 0;
        border-left: none;
    }

    .logo {
        margin-left: 8px;
    }
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--hover-bg);
}

/* Rich Text Formatting Styles */
.post-content,
.text-gray-900 {
    color: var(--text-primary);
}

.post-content strong,
.text-gray-900 strong {
    font-weight: 700;
    color: var(--text-primary);
}

.post-content em,
.text-gray-900 em {
    font-style: italic;
    color: var(--text-primary);
}

.post-content code,
.text-gray-900 code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.9em;
    color: #e01e5a;
}

.post-content pre,
.text-gray-900 pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.9em;
}

.post-content pre code,
.text-gray-900 pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

.post-content ul,
.text-gray-900 ul {
    list-style: none;
    margin: 12px 0;
    padding-left: 0;
}

.post-content ul li,
.text-gray-900 ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
}

.post-content ul li:before,
.text-gray-900 ul li:before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #18181b;
    font-weight: bold;
}

.post-content ol,
.text-gray-900 ol {
    list-style: decimal;
    margin: 12px 0;
    padding-left: 24px;
}

.post-content ol li,
.text-gray-900 ol li {
    margin-bottom: 8px;
}

/* Links within rendered markdown content only */
.post-content p a,
.post-content li a,
.post-content strong a,
.post-content em a,
.text-gray-900 p a,
.text-gray-900 li a,
.text-gray-900 strong a,
.text-gray-900 em a {
    color: #1d9bf0;
    text-decoration: none;
}

.post-content p a:hover,
.post-content li a:hover,
.post-content strong a:hover,
.post-content em a:hover,
.text-gray-900 p a:hover,
.text-gray-900 li a:hover,
.text-gray-900 strong a:hover,
.text-gray-900 em a:hover {
    text-decoration: underline;
}

/* Prevent wrapper links from showing underline */
a.block .post-content,
a.block .text-gray-900 {
    text-decoration: none !important;
}

.post-content blockquote,
.text-gray-900 blockquote {
    border-left: 4px solid #18181b;
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Toast UI Editor Customization */
.toastui-editor-defaultUI {
    border: 1px solid #e5e7eb !important;
    border-radius: 5rem !important;
}

.toastui-editor-defaultUI-toolbar {
    background-color: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0.5rem !important;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

.toastui-editor-toolbar-icons {
    background-color: transparent !important;
    border: none !important;
    color: #4b5563 !important;
    padding: 0.375rem !important;
    border-radius: 0.25rem !important;
    transition: background-color 0.2s !important;
}

.toastui-editor-toolbar-icons:hover {
    background-color: #e5e7eb !important;
}

.toastui-editor-toolbar-icons.active {
    background-color: #18181b !important;
    color: white !important;
}

.toastui-editor-contents {
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: #000000 !important;
    padding: 0.75rem 1rem !important;
}

.toastui-editor-contents p {
    margin: 0 0 0.5rem 0 !important;
    color: #000000 !important;
}

.toastui-editor-contents strong {
    font-weight: 700 !important;
    color: #000000 !important;
}

.toastui-editor-contents em {
    font-style: italic !important;
    color: #000000 !important;
}

.toastui-editor-contents code {
    background: #f7f9f9 !important;
    border: 1px solid #eff3f4 !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace !important;
    font-size: 0.9em !important;
    color: #e01e5a !important;
}

.toastui-editor-contents pre {
    background: #f7f9f9 !important;
    border: 1px solid #eff3f4 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    margin: 12px 0 !important;
}

/* Links within editor content only */
.toastui-editor-contents p a,
.toastui-editor-contents li a,
.toastui-editor-contents strong a,
.toastui-editor-contents em a {
    color: #195a79 !important;
    text-decoration: none !important;
}

.toastui-editor-contents p a:hover,
.toastui-editor-contents li a:hover,
.toastui-editor-contents strong a:hover,
.toastui-editor-contents em a:hover {
    text-decoration: underline !important;
}

.toastui-editor-contents ul,
.toastui-editor-contents ol {
    margin: 12px 0 !important;
    padding-left: 1.5rem !important;
}

.toastui-editor-contents ul li {
    list-style-type: disc !important;
    margin-bottom: 0.5rem !important;
}

.toastui-editor-contents ol li {
    list-style-type: decimal !important;
    margin-bottom: 0.5rem !important;
}

/* Editor in post composer */
.composer-header .toastui-editor-defaultUI {
    border: none !important;
    border-radius: 0 !important;
}

.composer-header .toastui-editor-defaultUI-toolbar {
    border-radius: 0 !important;
}

/* Make character counter work with editor */
.toastui-editor-ww-container {
    min-height: 100px !important;
}

/* Collapsed editor state - hide toolbar until focused */
.editor-collapsed .toastui-editor-defaultUI-toolbar {
    display: none !important;
}

.editor-collapsed .toastui-editor-defaultUI {
    border: 1px solid #e5e7eb !important;
}

.editor-collapsed .toastui-editor-contents {
    min-height: 50px !important;
}

/* Smooth transition for editor expansion */
.toastui-editor-defaultUI-toolbar {
    transition: all 0.2s ease-in-out !important;
}

/* Contain editor popups within the editor area */
.toastui-editor-defaultUI {
    position: relative !important;
    z-index: 0 !important;
}

.toastui-editor-popup,
.toastui-editor-tooltip {
    z-index: 10 !important;
}

/* ===== Reddit-style Comment Threading ===== */
/* ===== Comments (YouTube-style threaded) ===== */
.comment-node {
    position: relative;
}

.comment-main {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 8px 0;
    margin-left: 8px;
}

.comment-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
    line-height: 0;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    margin-right: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    position: relative;
    padding-right: 30px;
}

.comment-author {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.comment-author:hover {
    text-decoration: underline;
}

.comment-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-more {
    position: absolute;
    top: 0;
    right: 0;
}

.comment-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.comment-more-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.comment-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-primary);
    margin-top: 2px;
    word-break: break-word;
}

/* Action row: like (thumbs up) + count, dislike (visual), reply */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    margin-left: -6px;
}

.comment-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: transparent;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.comment-act:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.comment-act.like.active {
    color: var(--primary-color);
}

.comment-act-count {
    font-size: 12px;
    font-weight: 600;
}

.comment-act--static,
.comment-act--static:hover,
.comment-act--locked,
.comment-act--locked:hover {
    background: transparent;
    color: var(--text-secondary);
    cursor: default;
}

/* Show / hide replies toggle */
.comment-replies-bar {
    margin-left: 38px;
}

.comment-replies-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: transparent;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #3b82f6;
    transition: background 0.15s;
}

.comment-replies-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* Vertical thread line from a parent's avatar down into its replies */
.comment-node.has-replies > .comment-main::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 40px;
    bottom: -25px;
    width: 2px;
    background: var(--comment-thread);
}

/* Nested replies indented, connected by curved lines */
.comment-replies {
    margin-left: 13px;
}

.comment-replies > .comment-node {
    position: relative;
    padding-left: 25px;
    margin-left: 8px;
}

/* L-shaped curve branching from the thread line into each reply's avatar */
.comment-replies > .comment-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: -6px;
    width: 25px;
    height: 28px;
    border-left: 2px solid var(--comment-thread);
    border-bottom: 2px solid var(--comment-thread);
    border-bottom-left-radius: 14px;
}

/* Straight line continuing down to the next sibling reply */
.comment-replies > .comment-node:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0;
    top: -6px;
    bottom: 0;
    width: 2px;
    background: var(--comment-thread);
}


/* ===== Notification Badge ===== */
/* Nav item glow for active quiz */
.nav-item--glow {
    animation: navGlow 2s ease-in-out infinite;
}

.nav-item--glow .nav-icon {
    color: #18181b;
}

@keyframes navGlow {

    0%,
    100% {
        background: transparent;
    }

    50% {
        background: rgba(255, 95, 31, 0.1);
    }
}

.nav-live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    margin-left: 6px;
    animation: livePulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.nav-item .badge {
    background: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    line-height: 1;
}

/* ===== Bookmark Active State ===== */
.action-btn.bookmark.active {
    color: #ffd700;
}

.action-btn.bookmark.active .action-icon-wrapper {
    background: rgba(255, 215, 0, 0.1);
}

/* ===== Notification Item Styles ===== */
.notification-item {
    transition: background 0.2s ease;
    border-left: 3px solid transparent;
}

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

.notification-item.unread {
    /* Brand gradient: #dc2424 → #4a569d (translucent tint so text stays readable) */
    background: linear-gradient(135deg, rgba(220, 36, 36, 0.10) 0%, rgba(74, 86, 157, 0.12) 100%);
    border-left-color: #4a569d;
}

/* Toast UI Editor Minimalist Overrides */
.toastui-editor-defaultUI {
    border: none !important;
}

.toastui-editor-toolbar {
    border-bottom: none !important;
    background-color: transparent !important;
    padding: 0 4px !important;
}

.toastui-editor-defaultUI-toolbar {
    background-color: transparent !important;
    border: none !important;
}

.toastui-editor-ww-container,
.toastui-editor-md-container {
    background-color: transparent !important;
}

.toastui-editor-contents {
    font-family: inherit !important;
    font-size: 16px !important;
    color: var(--text-primary) !important;
}

.toastui-editor-contents p {
    color: var(--text-primary) !important;
}

/* Hide the horizontal line in the toolbar */
.toastui-editor-toolbar-divider {
    display: none !important;
}

/* Sleeker toolbar buttons */
.toastui-editor-toolbar button {
    border: none !important;
    background-color: transparent !important;
    color: var(--text-secondary) !important;
    border-radius: 4px !important;
    margin: 2px !important;
}

.toastui-editor-toolbar button:hover {
    background-color: var(--hover-bg) !important;
    color: var(--primary-color) !important;
}

.toastui-editor-toolbar button.active {
    background-color: var(--hover-bg) !important;
    color: var(--primary-color) !important;
}

/* Fix Z-Index for Toast UI Popups (Link, etc) */
.toastui-editor-popup {
    z-index: 100 !important;
}

/* Ensure placeholder doesn't interfere with interactivity */
.toastui-editor-placeholder {
    z-index: 1 !important;
}

/* Post Detail Header Styles */
.detail-header {
    height: 53px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border-color);
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 40;
}

/* Ensure back button in detail doesn't have focus rings or borders */
.detail-header a:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Moderator Accents */
.moderator-ring {
    position: relative;
    padding: 3px;
    background: linear-gradient(268deg, #ffd70099 0%, #e0d8ced6 100%);
    border-radius: 50%;
    display: inline-flex;
    width: fit-content;
    height: fit-content;
    margin: 0;
    align-items: center;
    justify-content: center;
    transform: translateY(-2px);
}

.moderator-ring .avatar,
.moderator-ring .avatar-mini,
.moderator-ring .post-author-avatar {
    transform: none;
}

/* Brand gradient — profile icon ring + mobile FAB (add more spots on request) */
.profile-ring {
    position: relative;
    padding: 2.5px;
    background: var(--brand-gradient);
    border-radius: 50%;
    display: inline-flex;
    width: fit-content;
    height: fit-content;
    align-items: center;
    justify-content: center;
}

.profile-ring .avatar,
.profile-ring .avatar-mini,
.profile-ring .post-author-avatar {
    transform: none;
    border: 2px solid var(--card-bg);
}

.avatar-mini--brand {
    background: var(--brand-gradient);
    color: #fff;
}

/* Mobile top header (app-name row) — shown on mobile only */
.mobile-top-header {
    display: none;
}

.mobile-top-header__avatar {
    display: inline-flex;
    text-decoration: none;
    flex-shrink: 0;
}

.mobile-top-header__brand {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-width: 0;
}

.mobile-top-header__brand .brand-wordmark {
    font-size: 20px;
}

/* Hamburger button that opens the mobile side drawer (top-right of mobile header) */
.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--hover-bg);
}

.mobile-menu-btn svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Mobile off-canvas side drawer (mirrors the desktop sidebar) */
.mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 65;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    background: var(--bg-primary);
    z-index: 70;
    display: flex;
    flex-direction: column;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.18);
}

.mobile-drawer__nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.mobile-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    z-index: 1;
}

.mobile-drawer-close:hover {
    background: var(--hover-bg);
}

.mobile-drawer-close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Mobile floating action button — shown on mobile only */
.mobile-fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 76px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(74, 86, 157, .35);
    z-index: 55;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.mobile-fab:hover,
.mobile-fab:active {
    transform: scale(1.06);
}

.mobile-fab svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.moderator-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(268deg, #ffd70099 0%, #e298d7d6 100%);
    color: #000;
    font-weight: 800;
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(255, 140, 0, 0.1);
}

@keyframes gold-glow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ==========================================
   Responsive Design Overhaul
   ========================================== */

@media (max-width: 1024px) {
    .right-sidebar {
        display: none;
    }

    .app-container {
        max-width: 100%;
    }
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 50;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    position: relative;
    text-decoration: none;
}

.nav-item-bottom svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item-bottom.active {
    color: var(--text-primary);
}

.nav-item-bottom.active svg {
    stroke-width: 2.5;
}

@media (max-width: 768px) {

    /* Layout */
    .app-container {
        flex-direction: column;
        padding-bottom: 70px;
    }

    .sidebar {
        display: none !important;
    }

    .right-sidebar {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .mobile-top-header {
        display: flex;
        align-items: center;
        gap: 12px;
        height: 52px;
        padding: 0 14px;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 60;
    }

    .mobile-fab {
        display: flex;
    }

    .main-content-wrapper {
        padding: 0;
    }

    /* Feed tabs/header stick just below the mobile header */
    .feed-tabs,
    .feed-header {
        top: 52px;
    }

    /* Flat, edge-to-edge posts on mobile (Twitter-style) */
    .post-card {
        padding: 12px 16px;
    }

    .post-composer {
        padding: 12px 16px;
    }

    /* Adjust typography */
    .post-content {
        font-size: 14px;
    }

    /* Leaderboard on mobile - if it appears in main content */
    .leaderboard-container {
        padding: 10px;
    }

    /* Trivia Grid */
    .quiz-grid {
        grid-template-columns: 1fr !important;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .mobile-top-bar img {
        height: 24px;
    }

    .post-actions {
        justify-content: space-between;
        padding-top: 8px;
    }
}

/* User Card Grid & Profile Cards */
.user-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.user-profile-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile-card:hover {
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
}

.user-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.user-card-avatar-wrapper {
    flex-shrink: 0;
}

.user-card-avatar,
.user-card-avatar-placeholder {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

.user-card-info {
    width: 100%;
}

.user-card-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-handle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.user-card-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0px;
}

.user-card-stat {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-card-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-card-badge.moderator {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fef08a;
}

[data-theme='dark'] .user-card-badge.moderator {
    background: #ffd70033;
    color: #ffd700;
    border: 1px solid #ffd70066;
}

.user-card-bio {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.5rem;
}

.user-card-actions {
    width: auto;
    flex-shrink: 0;
}

.follow-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}

[data-theme='dark'] .follow-btn {
    border: 1px solid white !important;
}

.follow-btn.following:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

.follow-btn.following:hover span {
    display: none;
}

.follow-btn.following:hover::after {
    content: 'Unfollow';
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.pagination-info {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    align-self: center;
}

/* Appearance Card on Profile */
.appearance-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    transition: all 0.3s ease;
}

.theme-label {
    color: var(--text-primary);
}

/* Dark Mode imagery refinements */
[data-theme='dark'] img:not(.avatar):not(.user-card-avatar):not(.post-author-avatar) {
    filter: brightness(.8) contrast(1.1);
}

[data-theme='dark'] .moderator-tag {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Coming soon screen (feature-gated pages) */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 70vh;
    padding: 40px 24px;
}

.coming-soon__icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hover-bg);
    color: var(--primary-color);
    margin-bottom: 20px;
}

.coming-soon__icon svg {
    width: 40px;
    height: 40px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.coming-soon__tag {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.coming-soon__title {
    font-size: 30px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.coming-soon__desc {
    max-width: 420px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 28px;
}

.coming-soon__back {
    text-decoration: none;
}

/* Moderator's @handle rendered as a small golden "royal" pill */
.mod-handle {
    background: linear-gradient(268deg, #ffd70099 0%, #e0d8ced6 100%);
    color: #000 !important;
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 700;
}

/* Moderator "Send a message" nav button (above the profile footer, red = urgent) */
.mod-message-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    padding: 10px 16px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #dc2424 0%, #b91c1c 100%);
    transition: opacity 0.2s;
}

.mod-message-btn:hover {
    opacity: 0.92;
}

.mod-message-btn.active {
    box-shadow: 0 0 0 2px rgba(220, 36, 36, 0.3);
}

.mod-message-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Toast — small confirmation popups (e.g. moderator actions) */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #18181b;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast::before {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-position: center;
    /* white check-circle icon */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2334d399'><path fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/></svg>");
}

.toast--show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .toast-container {
        bottom: 80px;
        /* clear the mobile bottom nav */
    }
}

/* Locked-thread frosted-glass banner (end of a locked discussion) */
.locked-thread {
    padding: 24px 16px 30px;
    /* subtle tint sits *behind* the glass so backdrop-filter has something to frost */
    background: linear-gradient(180deg, transparent 0%, rgba(220, 38, 38, 0.07) 100%);
}

.locked-thread__glass {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(31, 38, 135, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.locked-thread__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

.locked-thread__icon svg {
    width: 22px;
    height: 22px;
}

.locked-thread__title {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-primary);
}

.locked-thread__sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

[data-theme='dark'] .locked-thread__glass {
    background: rgba(30, 33, 38, 0.5);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}