.error-page {
    text-align: center;
    padding: 4rem 1rem;
}
.error-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.error-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal-card {
    width: 100%;
    max-width: 560px;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-card-wide {
    max-width: 700px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}
.modal-close-btn {
    font-size: 1.25rem;
}
.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
.form-row {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.topic-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-card-hover);
    transition: all 0.2s;
}
.topic-radio {
    width: auto;
    accent-color: var(--accent);
}
.inline-form {
    display: inline;
}
.text-muted {
    color: var(--text-muted);
}
.text-secondary {
    color: var(--text-secondary);
}
.text-primary {
    color: var(--text-primary);
}
.auth-field-gap {
    margin-bottom: 0.75rem;
}
.load-more-wrap {
    text-align: center;
    margin-top: 1rem;
}
.top-authors-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.top-authors-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.no-authors-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}
.no-comments-msg {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem 0;
}
.topic-wrap {
    margin-bottom: 0.75rem;
}
.related-section {
    margin-top: 1.5rem;
}
.related-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.related-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem;
    width: 100%;
    border-radius: var(--radius);
    transition: background 0.2s;
}
.related-link:hover {
    background: var(--bg-card);
}
.related-title {
    color: var(--text-primary);
    font-size: 0.875rem;
}
.related-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.v-align-middle {
    vertical-align: middle;
}
.mr-0-375 {
    margin-right: 0.375rem;
}
.flex-center {
    display: flex;
    align-items: center;
}
.flex-center-gap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.flex-col-gap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.full-width {
    width: 100%;
}
.justify-center {
    justify-content: center;
}
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}
.section-label {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}
.inline-flex {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.input-sm {
    font-size: 0.8125rem;
}
.min-h-100 {
    min-height: 100px;
}
.min-h-120 {
    min-height: 120px;
}
.min-h-200 {
    min-height: 200px;
}
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flex-wrap-gap {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}
.flex-wrap-gap-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}
.badge-type {
    background: var(--border);
    color: var(--text-muted);
    text-transform: capitalize;
}
.empty-state-full {
    grid-column: 1 / -1;
}
.projects-settings-btn {
    margin-left: auto;
}
.auth-field-gap-last {
    margin-bottom: 1rem;
}
.platform-presets-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}
.profile-actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.input-edit-field {
    margin-bottom: 0.5rem;
}
.save-btn-top {
    margin-top: 0.5rem;
}
.profile-tab-btn {
    margin-left: auto;
    font-size: 0.8125rem;
}
.post-action-static {
    cursor: default;
}
.activity-card {
    padding: 0.75rem 1rem;
}
.activity-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}
.activity-icon {
    color: var(--text-muted);
}
.activity-type {
    color: var(--text-secondary);
}
.activity-time {
    color: var(--text-muted);
}
.activity-content {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
}
.gist-card {
    display: block;
    text-decoration: none;
    color: inherit;
}
.platform-preset {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border: none;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

img {
    max-width: 100%;
    display: block;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-devlog { background: var(--topic-devlog); color: #fff; }
.badge-showcase { background: var(--topic-showcase); color: #fff; }
.badge-question { background: var(--topic-question); color: #fff; }
.badge-rant { background: var(--topic-rant); color: #fff; }
.badge-fun { background: var(--topic-fun); color: #000; }
.badge-random { background: var(--border-light); color: var(--text-secondary); }
.badge-signals { background: var(--topic-signals); color: #fff; }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-24 { width: 24px; height: 24px; }
.avatar-xs { width: 20px; height: 20px; font-size: 0.6875rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.8125rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 2rem; }
.avatar-img { border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
}
.topnav-inner {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
}
.topnav-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.topnav-logo span { color: var(--accent); }
.topnav-links { display: flex; gap: 0.25rem; }
.topnav-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.topnav-link:hover { color: var(--text-primary); background: var(--bg-card); }
.topnav-link.active { color: var(--accent); background: var(--accent-light); }
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.topnav-icon { position: relative; padding: 0.375rem; color: var(--text-secondary); font-size: 1.25rem; transition: color 0.2s; }
.topnav-icon:hover { color: var(--text-primary); }
.nav-badge {
    position: absolute; top: 0; right: 0; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff;
    font-size: 0.6875rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.topnav-user { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem; border-radius: var(--radius); transition: background 0.2s; }
.topnav-user:hover { background: var(--bg-card); }
.topnav-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.topnav-user-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); }
.topnav-user-role { font-size: 0.6875rem; color: var(--text-muted); }
.topnav-user-dropdown { position: relative; }
.topnav-user-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 1001;
}
.topnav-user-dropdown:hover .dropdown-menu { display: block; }
.dropdown-item {
    display: block;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg-card); color: var(--text-primary); }

.topnav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 0.375rem;
    cursor: pointer;
    line-height: 1;
}

.topnav-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.topnav-mobile-panel {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.topnav-mobile-panel.open {
    max-height: 500px;
    overflow-y: auto;
}

.topnav-mobile-links {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.125rem;
}

.topnav-mobile-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.topnav-mobile-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.topnav-mobile-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.topnav-mobile-divider {
    height: 1px;
    background: var(--border);
    margin: 0.375rem 0.75rem;
}

.topnav-mobile-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.topnav-mobile-user:hover {
    background: var(--bg-card);
    text-decoration: none;
}

.topnav-mobile-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topnav-mobile-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.topnav-mobile-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.25rem;
}

.user-avatar-link { display: inline-flex; flex-shrink: 0; line-height: 0; }
.user-avatar-link:hover { opacity: 0.85; }
.user-link { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text-primary); transition: color 0.2s; }
.user-link:hover { color: var(--accent); text-decoration: none; }
.user-link-name { font-weight: 600; font-size: 0.875rem; }
.user-link-role { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.post-author-link { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.post-author-link:hover { color: var(--accent); }
.post-detail-author { font-weight: 600; font-size: 0.9375rem; color: var(--text-primary); }
.post-detail-author:hover { color: var(--accent); }
.comment-author { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); }
.comment-author:hover { color: var(--accent); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.page {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-author-link {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.post-author-link:hover {
    color: var(--accent);
}

.icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: var(--text-primary);
}

.hint-text {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.avatar-md { width: 40px; height: 40px; font-size: 1rem; }

.emoji-toggle-btn {
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 1.125rem;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.emoji-toggle-btn:hover {
    color: var(--text-primary);
}

.page:has(.page-messages) {
    padding-top: 0;
}


.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

@media (max-width: 480px) {
    .modal-card {
        margin: 0.5rem;
    }
}

@media (max-width: 360px) {
    .page {
        padding: 0.25rem;
    }

    .card {
        padding: 0.75rem;
    }
}

.breadcrumb {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0.5rem 1rem;
    padding-top: calc(var(--nav-height) + 0.5rem);
    font-size: 0.8125rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.breadcrumb li + li::before {
    content: "/";
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb [aria-current="page"] {
    color: var(--text-muted);
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    padding: 1rem;
}
.footer-inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
}
.footer-copy {
    color: var(--text-muted);
}
.footer-links {
    display: flex;
    gap: 1rem;
}
.footer-links a {
    color: var(--text-muted);
}
.footer-links a:hover {
    color: var(--text-primary);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


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

    .topnav-hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topnav-user-info {
        display: none;
    }

    .topnav-inner {
        gap: 0.5rem;
    }
}


@media (max-width: 1024px) {
    .breadcrumb {
        padding: 0.375rem 0.5rem;
        padding-top: calc(var(--nav-height) + 0.375rem);
        font-size: 0.75rem;
    }
}


@media (max-width: 1024px) {
    .page {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .topnav-inner {
        padding: 0 0.5rem;
        gap: 0.25rem;
    }

    .topnav-logo {
        font-size: 1.125rem;
    }

    .topnav-right {
        gap: 0.375rem;
    }
}

@media (max-width: 360px) {
    .topnav-logo {
        font-size: 1rem;
    }

    .topnav-icon {
        font-size: 1.125rem;
        padding: 0.25rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .post-action-btn,
    .feed-nav-btn,
    .profile-tab,
    .sidebar-link,
    .topnav-link,
    .topnav-mobile-link {
        min-height: 44px;
    }

    .modal-card input,
    .modal-card textarea,
    .modal-card select {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .post-detail-title {
        font-size: 1.25rem;
    }

    .post-detail-content {
        font-size: 0.875rem;
    }

    .comment-text {
        font-size: 0.8125rem;
    }
}
