/* ========================================
   Agora - Modern Elegant Theme 
   ======================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #10b981;
    --accent-dark: #059669;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --success: #10b981;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-sm: 4px;
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    color-scheme: dark;
}

/* Number input spinners in dark mode */
[data-theme="dark"] input[type="number"] {
    color-scheme: dark;
}

/* Theme toggle - show moon in light mode, sun in dark mode */
#theme-toggle { background: none; border: none; cursor: pointer; }
#theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }

/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3 {
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}

/* Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.main-content {
    min-width: 0;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 80px;
    width: 300px;
    flex-shrink: 0;
}

.sidebar-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-box + .sidebar-box {
    margin-top: 16px;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-content {
    padding: 12px 16px;
}

.sidebar-boards {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-boards li {
    border-bottom: 1px solid var(--border-light);
}

.sidebar-boards li:last-child {
    border-bottom: none;
}

.sidebar-boards a {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    transition: background 0.15s ease;
}

.sidebar-boards a:hover {
    background: var(--border-light);
    color: var(--primary);
}

.sidebar-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.sidebar-rules {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-rules li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.sidebar-rules li:last-child {
    border-bottom: none;
}

.sidebar-rules .rule-expandable {
    cursor: pointer;
}

.sidebar-rules .rule-expandable summary {
    list-style: none;
}

.sidebar-rules .rule-expandable summary::-webkit-details-marker {
    display: none;
}

.sidebar-rules .rule-name {
    font-weight: 600;
    color: var(--text);
    transition: color 0.15s ease;
}

.sidebar-rules .rule-expandable:hover .rule-name {
    color: var(--primary);
}

.sidebar-rules .rule-desc {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.5;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
}

.sidebar-footer a {
    color: var(--primary);
}

/* Sidebar Tags */
.sidebar-tags {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sidebar-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--border-light);
    border-radius: 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-tag:hover {
    background: var(--primary);
    color: #fff;
}

/* Sidebar Admins */
.sidebar-admins {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-admins li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sidebar-admins li:last-child {
    border-bottom: none;
}

.admin-badge {
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid var(--border);
}

.admin-stats {
    font-size: 11px;
    color: var(--text-light);
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 10px;
    cursor: help;
}

.report-link {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-light);
}

.report-link:hover {
    color: var(--danger);
}

/* Admin Management */
.edit-sections {
    display: grid;
    gap: 32px;
}

.edit-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 24px;
}

.edit-section h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.admin-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.admin-item:last-child {
    margin-bottom: 0;
}

.admin-name {
    flex: 1;
    font-weight: 500;
}

.add-admin-form {
    margin-top: 16px;
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-inline input {
    flex: 1;
}

.text-danger {
    color: var(--danger);
}

.text-danger:hover {
    color: var(--danger-dark);
}

.warning {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 0 20px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.logo {
    font-weight: 700;
    font-size: 22px;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo:hover {
    color: #fff;
    opacity: 0.9;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a, .nav-links button {
    color: rgba(255,255,255,0.9);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-links a:hover, .nav-links button:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: var(--primary);
    padding: 0;
    transition: color 0.15s ease;
}

.link-btn:hover {
    color: var(--primary-dark);
}

.inline {
    display: inline;
}

/* Messages */
.messages {
    margin-bottom: 20px;
}

.message {
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* Posts */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.15s ease;
}

.post-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.post-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.post-type-icon svg {
    width: 20px;
    height: 20px;
}

/* Post type icon with board color background */
.post-type-icon[class*="board-color-"] {
    border: none;
    color: #374151;
}

/* Sort and View Controls */
.sort-and-create {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.view-btn {
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    box-sizing: border-box;
}

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

.view-btn.active {
    background: var(--primary);
    color: #fff;
}

.view-btn svg {
    width: 16px;
    height: 16px;
}

/* Image Grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.post-grid-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.post-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.post-grid-image {
    display: block;
    width: 100%;
    height: 100%;
}

.post-grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-grid-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 50px 12px 12px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.post-grid-item:hover .post-grid-overlay {
    opacity: 1;
}

.post-grid-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.grid-vote-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #fff;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-vote-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.grid-vote-btn.voted {
    background: var(--primary);
}

.grid-vote-score {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.post-grid-info {
    display: block;
    flex: 1;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.post-grid-info:hover .post-grid-title {
    text-decoration: underline;
}

.post-grid-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-grid-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.post-grid-meta a {
    color: rgba(255,255,255,0.9);
}

.post-grid-meta a:hover {
    color: #fff;
    text-decoration: underline;
}

.grid-empty {
    grid-column: 1 / -1;
}

/* Responsive grid */
@media (max-width: 640px) {
    .post-grid {
        grid-template-columns: 1fr;
    }

    .post-grid-overlay {
        opacity: 1;
    }

    .post-grid-item {
        aspect-ratio: 4/3;
    }
}

/* Hover states for touch devices */
@media (hover: none) {
    .post-grid-overlay {
        opacity: 1;
        background: linear-gradient(transparent 30%, rgba(0,0,0,0.9));
    }
}

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

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

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

.vote-btn.active {

    color: var(--primary);
}

.vote-btn.active.upvote {
    color: var(--accent);
}

.vote-btn.active.downvote {
    color: var(--danger);
}

.post-vote .score {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

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

.post-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

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

.post-title a:hover {
    color: var(--primary);
}

.post-domain {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 8px;
}

.post-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-meta a {
    color: var(--text-muted);
}

.post-meta a:hover {
    color: var(--primary);
}

/* Post Tags */
.post-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--border-light);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.post-tag:hover {
    background: var(--primary-light);
    color: #fff;
}

.post-tag.active {
    background: var(--primary);
    color: #fff;
}

.post-meta span {
    color: var(--text-light);
}

/* Post Detail */
.post-detail {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.post-detail .post-title {
    font-size: 24px;
    margin-bottom: 12px;
}

.post-detail .post-title a {
    color: var(--primary);
}

.post-body {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text);
    line-height: 1.7;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Radio group for view mode selection */
.radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: all 0.15s ease;
    font-size: 14px;
    color: var(--text-muted);
}

.radio-option input[type="radio"]:checked + .radio-label {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.radio-option input[type="radio"]:focus + .radio-label {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.radio-label:hover {
    border-color: var(--primary-light);
}

.radio-label svg {
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    height: 30px;
    box-sizing: border-box;
}

.btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

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

.btn-neutral {
    background: var(--border-light);
    color: var(--text);
    border: 1px solid var(--border);
}

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

div.sort-and-create {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.sort-and-create .sort-links {
    margin-bottom: 0;
}

.sort-and-create a {
    white-space: nowrap;
}

.form-errors {
    color: var(--danger);
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

/* Comments */
.comments {
    margin-top: 32px;
}

.comments h2 {
    font-size: 18px;
    margin: 0;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.comment-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-sort-label {
    font-size: 13px;
    color: var(--text-muted);
}

.comment-sort .sort-links {
    margin-bottom: 0;
    padding: 3px;
}

.comment-sort .sort-links a {
    padding: 4px 10px;
    font-size: 12px;
    height: auto;
}

/* Comment with vote */
.comment-main {
    display: flex;
    gap: 12px;
}

.comment-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 24px;
    padding-top: 2px;
}

.comment-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.comment-vote-btn.active {
    color: var(--accent);
}

.comment-vote-btn:disabled {
    cursor: wait;
    opacity: 0.5;
}

.comment-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

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

/* Comment thread containers */
.comment-threads {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-thread {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.comment {
    padding: 8px 0;
}

.comment:first-child {
    padding-top: 0;
}

/* Nested replies with thread line */
.comment-replies {
    margin-left: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--border-light);
    margin-top: 12px;
}

.comment-replies:hover {
    border-left-color: var(--bg);
}

.comment-nested {
    padding-top: 12px;
}

.comment-nested:first-child {
    padding-top: 8px;
}

.comment-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.comment-meta a {
    color: var(--text);
    font-weight: 600;
}

.comment-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.comment-content p {
    margin: 0 0 12px 0;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.reply-form {
    margin-top: 12px;
}

.reply-form summary {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.reply-form summary:hover {
    color: var(--primary);
}

.reply-form .form-group {
    margin-top: 12px;
}

.comment-form {
    background: var(--border-light);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.comment-form .form-group {
    margin-bottom: 12px;
}

/* Board */
.board-header {
    background: var(--bg-card);
    margin: -24px -20px 24px -20px;
    padding: 32px;
    border-bottom: 1px solid var(--border);
}

.board-header-wide {
    background: var(--bg-card);
    margin: -24px -20px 24px -20px;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
}

.board-title {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
}

.board-description {
    color: var(--text-muted);
    margin: 0;
    font-size: 15px;
    white-space: pre-line;
}

.board-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Sorting */
.sort-links {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    width: fit-content;
}

.sort-links a {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    height: 30px;
    box-sizing: border-box;
}

.sort-links a:hover {
    background: var(--border-light);
    color: var(--text);
}

.sort-links a.active {
    background: var(--primary);
    color: #fff;
}

/* Profile */
.profile-header {
    background: var(--bg-card);
    margin: -24px -20px 24px -20px;
    padding: 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.profile-username {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.profile-stats {
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 0;
}

.profile-stats > span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-stats > span:not(:last-child)::after {
    content: "|";
    margin-left: 8px;
    margin-right: 8px;
    color: var(--text-light);
}

.profile-stats .link-button {
    font-size: 14px;
}

/* Boards list */
.boards-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.boards-list li {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    transition: all 0.15s ease;
}

.boards-list li:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.boards-list a {
    font-weight: 600;
    font-size: 17px;
}

.boards-list .board-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.board-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

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

.subscribe-btn {
    flex-shrink: 0;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 32px;
}

.auth-form {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 16px;
    }

    .nav {
        height: 50px;
    }

    .logo {
        font-size: 18px;
    }

    .nav-links a, .nav-links button {
        padding: 6px 10px;
        font-size: 13px;
    }

    .post-item {
        padding: 14px 16px;
    }

    .post-title {
        font-size: 15px;
    }

    .board-header,
    .profile-header {
        margin: -16px -16px 20px -16px;
        padding: 24px;
    }

    .board-title,
    .profile-username {
        font-size: 22px;
    }
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

.text-small {
    font-size: 13px;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* Board Colors */
.board-color-square {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 3px;
}

/* Board Icon - small square indicator replacing /b/ prefix */
.board-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--primary);
    margin-right: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

/* Board link with icon */
.board-link {
    display: inline-flex;
    align-items: center;
}

.board-link .board-icon {
    margin-right: 5px;
}

/* Board icon in sidebar header - use board accent color */
.board-accent .sidebar-header .board-icon {
    background: var(--board-color);
}

/* Larger board icon for headers */
.board-icon-lg {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--primary);
    margin-right: 6px;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

/* Board title with icon */
.board-title-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-title-with-icon .board-icon-lg {
    flex-shrink: 0;
    margin-right: 0;
    top: 0;
}

.board-color-rose { background-color: #fda4af; }
.board-color-peach { background-color: #fdba74; }
.board-color-amber { background-color: #fcd34d; }
.board-color-lime { background-color: #bef264; }
.board-color-emerald { background-color: #6ee7b7; }
.board-color-cyan { background-color: #67e8f9; }
.board-color-sky { background-color: #7dd3fc; }
.board-color-indigo { background-color: #a5b4fc; }
.board-color-violet { background-color: #c4b5fd; }
.board-color-fuchsia { background-color: #f0abfc; }
.board-color-pink { background-color: #f9a8d4; }
.board-color-slate { background-color: #cbd5e1; }

/* Board Accent Colors - applied via inline style */
.board-accent .btn {
    background: var(--board-color);
    color: #1e293b;
}
.board-accent .btn:hover {
    background: var(--board-color);
    filter: brightness(0.9);
    color: #1e293b;
}
.board-accent .btn-secondary {
    background: var(--bg);
    color: var(--text);
}
.board-accent .sidebar-header {
    background: var(--board-color);
    color: #1e293b;
}
.board-accent .sort-links a.active {
    background: var(--board-color);
    color: #1e293b;
}
.board-accent .view-btn.active {
    background: var(--board-color);
    color: #1e293b;
}
.board-accent .board-header-wide {
    border-bottom-color: var(--board-color);
    border-bottom-width: 3px;
}
.board-accent .board-title {
    color: var(--board-color);
    filter: brightness(0.7);
}

/* Sidebar in board view - more neutral/subdued styling */
.board-accent .sidebar .sidebar-header {
    background: var(--border-light);
    color: var(--text);
}

[data-theme="dark"] .board-accent .sidebar .sidebar-header {
    background: var(--border);
    color: var(--text);
}

/* Neutral buttons in sidebar (unsubscribe, board settings) */
.board-accent .sidebar .btn {
    background: var(--border-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.board-accent .sidebar .btn:hover {
    background: var(--border);
    filter: none;
    color: var(--text);
}

.board-accent .sidebar .btn.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.board-accent .sidebar .btn.btn-primary:hover {
    background: var(--primary-dark);
}

/* Rule Management */
.section-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.rule-item {
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
}

.rule-item:last-child {
    margin-bottom: 0;
}

.rule-display .rule-expandable-edit {
    cursor: pointer;
    margin-bottom: 8px;
}

.rule-display .rule-expandable-edit summary {
    list-style: none;
}

.rule-display .rule-expandable-edit summary::-webkit-details-marker {
    display: none;
}

.rule-display .rule-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rule-display .rule-name {
    font-weight: 600;
    color: var(--text);
    transition: color 0.15s ease;
}

.rule-display .rule-expandable-edit:hover .rule-name {
    color: var(--primary);
}

.rule-display .rule-penalty {
    font-size: 12px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.rule-display .rule-description {
    color: var(--text-muted);
    font-size: 14px;
    margin: 8px 0 0 0;
    line-height: 1.5;
}

.hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.rule-actions {
    display: flex;
    gap: 12px;
}

.rule-actions .link-btn {
    font-size: 13px;
    font-weight: 500;
}

.rule-actions .rule-delete-btn {
    color: var(--danger);
}

.rule-actions .rule-delete-btn:hover {
    color: var(--danger-dark);
}

.rule-edit-form {
    padding-top: 8px;
}

.rule-edit-form .form-group {
    margin-bottom: 12px;
}

.rule-edit-form .form-group:last-of-type {
    margin-bottom: 16px;
}

.rule-edit-form label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.rule-edit-form input,
.rule-edit-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: all 0.15s ease;
}

.rule-edit-form input:focus,
.rule-edit-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.rule-edit-form input[type="number"] {
    width: 100px;
}

.form-actions-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-rule-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

#add-rule-form {
    margin-top: 16px;
    background: var(--border-light);
    padding: 16px;
    border-radius: var(--radius-sm);
}

#add-rule-form .form-group {
    margin-bottom: 12px;
}

#add-rule-form .form-group:last-of-type {
    margin-bottom: 16px;
}

#add-rule-form input,
#add-rule-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: all 0.15s ease;
}

#add-rule-form input:focus,
#add-rule-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#add-rule-form input[type="number"] {
    width: 100px;
}

.no-rules {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
    text-align: center;
    background: var(--border-light);
    border-radius: var(--radius-sm);
}

/* Report Form */
.report-form-container {
    max-width: 800px;
    margin: 0 auto;
}

.report-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.report-header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
}

.report-header .subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: 16px;
    font-weight: 400;
}

.report-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.report-target-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.report-target-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.target-preview {
    background: var(--border-light);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.6;
}

.target-preview strong {
    color: var(--text);
    font-weight: 600;
}

.target-preview .meta {
    color: var(--text-muted);
    font-size: 13px;
    margin: 4px 0 0 0;
}

.target-preview .content {
    color: var(--text);
    margin: 12px 0 0 0;
}

.target-preview .warning {
    background: #fef3c7;
    color: #92400e;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin: 12px 0 0 0;
}

.report-rules-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.report-rules-section h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--text);
}

.rule-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.rule-card {
    position: relative;
    background: var(--border-light);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    overflow: hidden;
}

.rule-card:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: var(--shadow-sm);
}

.rule-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.rule-card-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
}

.rule-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-light);
    border-radius: 50%;
    cursor: pointer;
    background: white;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin: 0;
}

.rule-radio:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.rule-radio:checked {
    background: var(--primary);
    border-color: var(--primary-dark);
    box-shadow: inset 0 0 0 2px white;
}

.rule-card-content {
    flex: 1;
}

.rule-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.rule-scope {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rule-scope.board-scope {
    background: #dbeafe;
    color: #0369a1;
}

.rule-scope.site-scope {
    background: #dcfce7;
    color: #15803d;
}

.rule-details-toggle {
    padding: 0 16px;
}

.rule-details-toggle summary {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    list-style: none;
}

.rule-details-toggle summary::-webkit-details-marker {
    display: none;
}

.rule-details-toggle summary:hover {
    color: var(--primary);
}

.rule-details-toggle[open] summary {
    color: var(--primary);
}

.rule-details-toggle .rule-description {
    padding: 0 0 12px 0;
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.rule-checkmark {
    display: none;
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
}

.rule-card-label:has(input:checked) .rule-checkmark {
    display: block;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.1);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.report-info {
    background: var(--border-light);
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 24px;
}

.report-info h4 {
    margin: 0 0 12px 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.report-info ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.report-info li {
    color: var(--text-muted);
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .report-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
    }

    .report-header h1 {
        font-size: 22px;
    }

    .rule-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Nav Dropdown (Community menu) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.9);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.nav-dropdown-toggle:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-dropdown.open .nav-dropdown-toggle {
    background: rgba(255,255,255,0.15);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
    z-index: 1000;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.nav-dropdown-menu a:hover {
    background: var(--border-light);
    color: var(--primary);
}

.nav-dropdown-menu svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.nav-dropdown-menu a:hover svg {
    color: var(--primary);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.user-dropdown-toggle:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.user-dropdown.open .user-dropdown-toggle {
    background: rgba(255,255,255,0.2);
}

.user-icon {
    width: 20px;
    height: 20px;
}

.user-dropdown-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
    z-index: 1000;
}

.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu a,
.user-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
    background: var(--border-light);
    color: var(--primary);
}

.user-dropdown-menu svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-dropdown-menu a:hover svg,
.user-dropdown-menu button:hover svg {
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.user-dropdown-menu form {
    margin: 0;
}

@media (max-width: 640px) {
    .user-dropdown-name {
        display: none;
    }

    .user-dropdown-toggle {
        padding: 8px 10px;
    }
}

/* ========================================
   Jdenticon Avatars
   ======================================== */

/* Navigation avatar */
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Profile page avatar */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 3px solid var(--border-light);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-bio {
    margin-top: 8px;
    color: var(--text);
    line-height: 1.6;
}

/* Comment avatar */
.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-header .comment-meta {
    margin-bottom: 0;
}

/* Post author avatar */
.post-author-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 2px;
}

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* Admin avatar in sidebar */
.admin-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-avatar {
        width: 64px;
        height: 64px;
    }

    .profile-stats {
        justify-content: center;
    }
}

/* ========================================
   Nav Icon Buttons (Bell, Jury, etc.)
   ======================================== */

.nav-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    transition: all 0.2s ease;
}

.nav-icon-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-icon-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nav-icon-btn.has-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    animation: icon-pulse 3s ease-in-out infinite;
}

.nav-icon-btn.has-pending svg {
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.6));
}

.nav-icon-btn.has-pending:hover {
    background: rgba(251, 191, 36, 0.3);
    color: #fef08a;
}

@keyframes icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.icon-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid var(--primary-dark);
}

@media (max-width: 640px) {
    .nav-icon-btn {
        width: 40px;
        height: 40px;
    }

    .nav-icon-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* ========================================
   Markdown Editor
   ======================================== */

.markdown-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}

.md-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}

.md-tabs {
    display: flex;
    gap: 4px;
}

.md-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

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

.md-tab.active {
    color: var(--text);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.md-hint {
    font-size: 12px;
    color: var(--text-light);
}

.markdown-editor textarea {
    border: none;
    border-radius: 0;
    min-height: 200px;
    resize: vertical;
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.markdown-editor textarea:focus {
    outline: none;
    box-shadow: none;
}

.markdown-preview {
    padding: 16px;
    min-height: 200px;
    background: var(--bg-card);
}

.preview-placeholder {
    color: var(--text-light);
    font-style: italic;
}

/* ========================================
   Markdown Rendered Content
   ======================================== */

.markdown-content {
    line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content p {
    margin: 0 0 1em 0;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0 0 1em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.25em;
}

.markdown-content blockquote {
    margin: 0 0 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--primary);
    background: var(--border-light);
    color: var(--text-muted);
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: var(--border-light);
    border-radius: var(--radius-sm);
}

.markdown-content pre {
    margin: 0 0 1em 0;
    padding: 1em;
    background: var(--border-light);
    border-radius: var(--radius);
    overflow-x: auto;
}

.markdown-content pre code {
    padding: 0;
    background: transparent;
    font-size: 13px;
    line-height: 1.5;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: var(--primary-light);
    text-underline-offset: 2px;
}

.markdown-content a:hover {
    text-decoration-color: var(--primary);
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5em 0;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1em 0;
}

.markdown-content th,
.markdown-content td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-content th {
    background: var(--border-light);
    font-weight: 600;
}

/* Dark mode adjustments for code blocks */
[data-theme="dark"] .markdown-content pre,
[data-theme="dark"] .markdown-content code {
    background: #0f172a;
}

[data-theme="dark"] .markdown-content blockquote {
    background: #0f172a;
}

/* ========================================
   Link Button (styled as link)
   ======================================== */

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.link-button:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.inline-form {
    display: inline;
}

/* ========================================
   Blocked Users Section (Settings)
   ======================================== */

.blocked-users-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    margin-top: 24px;
}

.blocked-users-section h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.blocked-users-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blocked-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.blocked-user-item:last-child {
    margin-bottom: 0;
}

.blocked-user-item a {
    font-weight: 500;
}

.unblock-btn {
    color: var(--danger);
}

.unblock-btn:hover {
    color: var(--danger-dark);
}

.help-text {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 16px 0;
}

.blocked-users-section .help-text:only-child {
    margin-bottom: 0;
}

/* ========================================
   Sticky Posts
   ======================================== */

/* Sticky post indicator in list view */
.post-item.sticky {
    background: var(--border-light);
    border-left: 3px solid var(--accent);
}

.sticky-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sticky-indicator svg {
    width: 14px;
    height: 14px;
}

/* Sticky option in create/edit forms */
.sticky-option {
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.checkbox-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pin-icon {
    color: var(--text-muted);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-text .pin-icon {
    color: var(--accent);
}

.sticky-option .help-text {
    margin: 8px 0 0 28px;
    font-size: 13px;
}

/* Sticky post in grid view */
.post-grid-item.sticky {
    border: 2px solid var(--accent);
}

.post-grid-item.sticky::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    z-index: 10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='17' x2='12' y2='22'%3E%3C/line%3E%3Cpath d='M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* ========================================
   Video Grid View
   ======================================== */

.post-video-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-video-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.15s ease;
}

.post-video-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.post-video-item.sticky {
    border-left: 3px solid var(--accent);
}

.post-video-thumbnail {
    display: block;
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
}

.post-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s ease;
}

.video-play-button svg {
    width: 28px;
    height: 28px;
    margin-left: 4px;
}

.post-video-thumbnail:hover .video-play-button {
    background: var(--primary);
    transform: translate(-50%, -50%) scale(1.1);
}

.post-video-info {
    display: flex;
    gap: 12px;
    padding: 16px;
}

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

.post-video-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.post-video-title a {
    color: var(--text);
}

.post-video-title a:hover {
    color: var(--primary);
}

.post-video-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-video-meta a {
    color: var(--text-muted);
}

.post-video-meta a:hover {
    color: var(--primary);
}

/* Video empty state */
.video-empty {
    text-align: center;
    padding: 60px 20px;
}

/* ========================================
   Video Embed in Post Detail
   ======================================== */

.post-video {
    margin: 20px 0;
}

.video-embed-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========================================
   Inline Video Player (Board View)
   ======================================== */

.post-video-player {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.post-video-player .video-thumbnail-wrapper {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.post-video-player .video-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-video-player iframe {
    width: 100%;
    height: 100%;
}

.post-video-player.playing {
    background: #000;
}

/* ========================================
   Mention Autocomplete
   ======================================== */

.mention-autocomplete-wrapper {
    position: relative;
}

.mention-autocomplete {
    position: absolute;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    min-width: 180px;
    display: none;
}

.mention-autocomplete.visible {
    display: block;
}

.mention-autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mention-autocomplete-item:hover,
.mention-autocomplete-item.active {
    background: var(--border-light);
}

.mention-autocomplete-item .mention-username {
    color: var(--primary);
    font-weight: 500;
}

.mention-autocomplete-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mention-autocomplete-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================
   Onboarding Tutorial System
   ======================================== */

/* Backdrop overlay */
.tutorial-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tutorial-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Spotlight hole for highlighting elements */
.tutorial-spotlight {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius);
    transition: all 0.4s ease;
}

.tutorial-spotlight::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--primary);
    border-radius: calc(var(--radius) + 4px);
    animation: tutorial-pulse 2s ease-in-out infinite;
}

@keyframes tutorial-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.02); }
}

/* Arrow pointer */
.tutorial-arrow {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    transition: all 0.4s ease;
}

.tutorial-arrow svg {
    width: 48px;
    height: 48px;
    stroke: var(--primary);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: tutorial-bounce 1s ease-in-out infinite;
}

@keyframes tutorial-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Tutorial modal */
.tutorial-modal {
    position: fixed;
    z-index: 10000;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: calc(100vw - 40px);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tutorial-modal.visible {
    opacity: 1;
}

.tutorial-modal.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Modal positioned near highlighted element */
.tutorial-modal.position-bottom {
    /* JavaScript will set top/left */
}

.tutorial-modal.position-top {
    /* JavaScript will set top/left */
}

.tutorial-modal.position-left {
    /* JavaScript will set top/left */
}

.tutorial-modal.position-right {
    /* JavaScript will set top/left */
}

/* Tutorial slide content */
.tutorial-slide {
    padding: 32px 28px 24px;
    text-align: center;
}

.tutorial-illustration {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-illustration svg {
    width: 100%;
    height: 100%;
}

.tutorial-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    line-height: 1.2;
}

.tutorial-text {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

.tutorial-text strong {
    color: var(--text);
    font-weight: 600;
}

/* Tutorial footer */
.tutorial-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--border-light);
    border-top: 1px solid var(--border);
}

.tutorial-progress {
    display: flex;
    gap: 6px;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.2s ease;
}

.tutorial-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.tutorial-dot.completed {
    background: var(--primary-light);
}

.tutorial-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tutorial-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.tutorial-skip:hover {
    color: var(--text);
    background: var(--border);
}

.tutorial-next {
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tutorial-next:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.tutorial-next svg {
    width: 16px;
    height: 16px;
}

/* Welcome slide special styling */
.tutorial-slide.welcome .tutorial-illustration {
    width: 140px;
    height: 140px;
}

/* Feature list in slides */
.tutorial-features {
    text-align: left;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.tutorial-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.tutorial-features li:last-child {
    margin-bottom: 0;
}

.tutorial-features li svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Mini icons in tutorial text */
.tutorial-icon-inline {
    display: inline-flex;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    padding: 2px;
    background: var(--border-light);
    border-radius: 4px;
    margin: 0 2px;
}

.tutorial-icon-inline svg {
    width: 100%;
    height: 100%;
    stroke: var(--text);
}

/* Dark mode adjustments */
[data-theme="dark"] .tutorial-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .tutorial-spotlight {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .tutorial-modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .tutorial-footer {
    background: var(--bg);
}

/* Mobile responsive */
@media (max-width: 600px) {
    .tutorial-modal {
        max-width: calc(100vw - 24px);
    }

    .tutorial-slide {
        padding: 24px 20px 20px;
    }

    .tutorial-illustration {
        width: 100px;
        height: 100px;
    }

    .tutorial-title {
        font-size: 20px;
    }

    .tutorial-footer {
        padding: 12px 20px;
    }

    .tutorial-actions {
        gap: 8px;
    }
}