:root {
    --bg: #080a0f;
    --bg-soft: #111722;
    --bg-card: #161f2d;
    --ink: #e7edf7;
    --muted: #95a4bf;
    --line: #243249;
    --accent: #f4bb37;
    --accent-strong: #ff8a1e;
    --danger: #ff6a6a;
    --ok: #55c97a;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at 20% 0%, rgba(244, 187, 55, 0.08), transparent 35%),
        radial-gradient(circle at 80% 10%, rgba(255, 138, 30, 0.09), transparent 45%),
        linear-gradient(165deg, #06080d 0%, #0a0f18 40%, #0b111c 100%);
    color: var(--ink);
    font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
    min-height: 100%;
}

.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 75%);
    z-index: 0;
}

.container,
.site-footer {
    position: relative;
    z-index: 1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(16px);
    background: rgba(7, 10, 16, 0.84);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px clamp(14px, 3vw, 28px);
}

.brand-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.top-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.top-nav a {
    color: var(--ink);
    text-decoration: none;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.top-nav a:hover {
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}

.role-pill {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1304;
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    border-radius: 999px;
    padding: 6px 12px;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(16px, 2.8vw, 30px);
}

.panel {
    background: linear-gradient(180deg, rgba(22, 31, 45, 0.86), rgba(16, 22, 32, 0.86));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(14px, 2vw, 24px);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

h1,
h2,
h3 {
    margin-top: 0;
    letter-spacing: 0.01em;
}

a {
    color: #ffd474;
}

a:hover {
    color: #ffe5a6;
}

.muted {
    color: var(--muted);
}

.forum-list,
.topic-list,
.member-list,
.post-stream {
    display: grid;
    gap: 12px;
}

.forum-card,
.topic-row,
.member-row,
.post-card,
.search-result {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

.forum-card {
    margin-left: calc(var(--depth, 0) * 18px);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.forum-main h3,
.topic-main h3,
.member-row h3,
.search-result h3 {
    margin-bottom: 8px;
}

.member-row form {
    margin-top: 10px;
}

.forum-stats,
.topic-stats {
    display: grid;
    gap: 6px;
    text-align: right;
    color: var(--muted);
    min-width: 180px;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
}

.badge-private {
    background: rgba(255, 106, 106, 0.18);
    color: #ffd0d0;
    border: 1px solid rgba(255, 106, 106, 0.4);
}

.post-card {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
}

.post-author {
    border-right: 1px solid var(--line);
    padding-right: 12px;
    color: var(--muted);
}

.post-author h3 {
    margin-bottom: 10px;
}

.post-meta {
    color: var(--muted);
    margin-bottom: 10px;
}

.rich-text {
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.rich-text pre {
    background: #0c1320;
    border: 1px solid #213049;
    border-radius: 8px;
    padding: 10px;
    overflow: auto;
}

.rich-text blockquote {
    margin: 8px 0;
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    color: #d9e4f5;
    background: rgba(255, 255, 255, 0.02);
}

.bb-u {
    text-decoration: underline;
}

.bb-s {
    text-decoration: line-through;
}

.bb-img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.search-form {
    display: grid;
    gap: 8px;
    max-width: 520px;
}

.search-form input,
.search-form select,
.search-form button {
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #0b121d;
    color: var(--ink);
    padding: 10px 12px;
    font: inherit;
}

.search-form button {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #1a1304;
    font-weight: 700;
    cursor: pointer;
}

.search-form button:hover {
    filter: brightness(1.07);
}

.error {
    color: #ffd6d6;
    background: rgba(255, 106, 106, 0.14);
    border: 1px solid rgba(255, 106, 106, 0.35);
    border-radius: 8px;
    padding: 10px;
}

.meta-grid {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 8px 14px;
}

.meta-grid dt {
    color: var(--muted);
}

.pagination {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
}

.pagination a {
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 12px;
    background: #0f1826;
}

.archived-post {
    border-top: 1px dashed var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.site-footer {
    max-width: 1080px;
    margin: 12px auto 26px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 clamp(16px, 2vw, 24px);
}

.fade-in {
    animation: fade-up 0.5s ease both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .post-card {
        grid-template-columns: 1fr;
    }

    .post-author {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 10px;
    }

    .forum-card,
    .topic-row {
        flex-direction: column;
    }

    .forum-stats,
    .topic-stats {
        text-align: left;
        min-width: 0;
    }

    .site-header {
        grid-template-columns: 1fr;
    }

    .role-pill {
        justify-self: start;
    }
}
