:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --line: #e4e8f0;
    --accent: #2563eb;
    --accent-2: #0f766e;
    --shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.08), transparent 28rem),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 18rem);
    color: var(--text);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(18px, 4vw, 48px);
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid rgba(228, 232, 240, 0.9);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #172033;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.brand-title {
    font-weight: 760;
    letter-spacing: 0;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    background: #eef2f7;
    border-radius: 8px;
}

.nav a {
    padding: 8px 13px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 650;
}

.nav a.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(23, 32, 51, 0.08);
}

.layout {
    width: min(1280px, calc(100% - 32px));
    margin: 28px auto 64px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats div {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
}

.stats strong {
    display: block;
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1;
}

.stats span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.panel,
.thread-header {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
    margin-top: 0;
}

.panel h1,
.thread-header h1 {
    margin-bottom: 4px;
    font-size: clamp(24px, 3.6vw, 38px);
    line-height: 1.14;
}

.panel-head p,
.thread-header .topic-meta,
.topic-row p,
.topic-meta,
.post-author span {
    color: var(--muted);
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
    gap: 10px;
    width: min(680px, 100%);
}

input,
select,
button {
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 0 12px;
}

button {
    padding: 0 18px;
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.forum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 20px;
}

.forum-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.forum-card:hover,
.topic-row:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.35);
    background: #fff;
}

.forum-title {
    font-weight: 760;
}

.forum-meta {
    color: var(--muted);
    font-size: 13px;
}

.topic-list {
    display: grid;
}

.topic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 18px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

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

.topic-title {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 18px;
    font-weight: 760;
    line-height: 1.25;
    text-decoration: none;
}

.topic-title:hover,
.back-link:hover {
    color: var(--accent);
}

.topic-row p {
    margin-bottom: 10px;
}

.topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
}

.topic-count {
    align-self: center;
    justify-self: end;
    width: 82px;
    padding: 12px;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--accent);
    text-align: center;
}

.topic-count strong {
    display: block;
    font-size: 22px;
    line-height: 1;
}

.topic-count span {
    font-size: 12px;
    color: #3566a7;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 24px 24px;
    border-top: 1px solid var(--line);
}

.pager a {
    min-width: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    text-decoration: none;
}

.pager a.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.pager a.disabled {
    pointer-events: none;
    color: #b5bdca;
}

.thread-header {
    padding: 24px;
    margin-bottom: 18px;
}

.back-link {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
}

.posts {
    display: grid;
    gap: 14px;
}

.post {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(23, 32, 51, 0.05);
    overflow: hidden;
}

.post-author {
    padding: 20px;
    background: var(--panel-2);
    border-right: 1px solid var(--line);
}

.avatar {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 800;
}

.post-author strong,
.post-author span {
    display: block;
    overflow-wrap: anywhere;
}

.post-body {
    min-width: 0;
    padding: 18px 22px 22px;
}

.post-body header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
}

.post-body header a {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.post-body h2 {
    margin-bottom: 12px;
    font-size: 17px;
}

.content {
    overflow-wrap: anywhere;
}

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

.content blockquote,
.content .quote {
    margin: 14px 0;
    padding: 12px 14px;
    border-left: 4px solid #c7d2fe;
    background: #f5f7ff;
}

.content pre,
.content code,
.content .code {
    max-width: 100%;
    overflow: auto;
    border-radius: 8px;
    background: #111827;
    color: #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.content pre,
.content .code {
    padding: 14px;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.content table {
    max-width: 100%;
    border-collapse: collapse;
}

.content td,
.content th {
    padding: 8px;
    border: 1px solid var(--line);
}

@media (max-width: 860px) {
    .topbar,
    .panel-head,
    .topic-head {
        display: grid;
    }

    .filters,
    .stats,
    .post {
        grid-template-columns: 1fr;
    }

    .post-author {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 560px) {
    .layout {
        width: min(100% - 20px, 1280px);
        margin-top: 16px;
    }

    .topbar {
        position: static;
        padding: 14px;
    }

    .topic-row {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .topic-count {
        justify-self: start;
    }
}
