:root {
    font-family: "Inter", "Geist", ui-sans-serif, system-ui, sans-serif;
    line-height: 1.55;
    color-scheme: dark;
    --bg: #11131d;
    --surface: #191c2a;
    --border: #30364b;
    --text: #f3f4ff;
    --muted: #aab1c9;
    --accent: #b1a2ff;
    --soft: #24223c;
    --hover: #202438;
    --primary: #6246d2;
    --primary-hover: #5438be;
    --danger: #ff9eab;
    --radius: 16px;
    --cover-start: #222453;
    --cover-end: #27203e;
    --cover-spot: #3f3578;
    --cover-grid: #ffffff12;
    --shadow: 0 10px 32px #03041130;
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #fff;
    --border: #dde0ed;
    --text: #21243b;
    --muted: #5a627d;
    --accent: #5639c3;
    --soft: #efebff;
    --hover: #f8f7ff;
    --danger: #9d1638;
    --cover-start: #e9e3ff;
    --cover-end: #f4efff;
    --cover-spot: #c7c2f9;
    --cover-grid: #6654b620;
    --shadow: 0 10px 32px #28224a0c;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p, summary { overflow-wrap: anywhere; }
h2 { font-size: 1.18rem; line-height: 1.3; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
.wrap { width: min(100% - 40px, 1180px); margin-inline: auto; }
.skip {
    position: fixed;
    z-index: 2;
    top: .7rem;
    left: .7rem;
    padding: .6rem 1rem;
    background: var(--surface);
    border-radius: .5rem;
    transform: translateY(-200%);
}
.skip:focus { transform: translateY(0); }
.top { border-bottom: 1px solid var(--border); background: var(--surface); }
.bar, .bar nav { display: flex; align-items: center; }
.bar { min-height: 72px; gap: 20px; padding-block: 10px; }
.bar nav { gap: 12px; flex-wrap: wrap; font-size: .88rem; }
.main-nav a { padding: 7px 11px; border-radius: 8px; font-weight: 630; color: var(--muted); }
.main-nav a:hover, .main-nav a[aria-current] { background: var(--soft); color: var(--accent); }
.account-nav { margin-inline-start: auto; }
.account-nav .link { color: var(--muted); }
.account-nav .link:hover { color: var(--text); }
.nav-profile { display: flex; align-items: center; gap: 8px; font-weight: 670; overflow-wrap: anywhere; }
.nav-profile .avatar { width: 29px; height: 29px; font-size: .8rem; }
.brand { font-size: 1.32rem; font-weight: 770; letter-spacing: -.045em; display: flex; align-items: center; gap: .65rem; }
.logo {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(145deg, #8364f6, #4831bb);
    color: #fff;
}
.page { flex: 1; padding-block: 26px 40px; }
.hero h1, .cover h1, .profile-identity h1 {
    font-size: clamp(1.85rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -.045em;
    line-height: 1.12;
    margin: 0;
}
.hero { margin-bottom: 20px; }
.cover {
    background:
        radial-gradient(ellipse at 85% -10%, var(--cover-spot), transparent 64%),
        repeating-linear-gradient(120deg, transparent 0 29px, var(--cover-grid) 29px 30px),
        linear-gradient(100deg, var(--cover-start), var(--cover-end));
}
.forum-cover {
    display: flex;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
    gap: 14px;
    padding: clamp(20px, 4vw, 42px);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.forum-cover .btn { gap: 8px; }
.columns, .admin-grid { display: grid; align-items: start; gap: 22px; }
.columns { grid-template-columns: minmax(0, 2.6fr) minmax(220px, 1fr); }
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sectionhead, .threadbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.sectionhead { margin-bottom: 12px; }
.sectionhead h2, .sectionhead p { margin: 4px 0; }
.panel, .category, .post {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 20px;
    margin: 0 0 14px;
}
.panel > :first-child { margin-top: 0; }
.category, .discussion-list, .profile-card { padding: 0; }
.category, .sidebar, .profile-card { box-shadow: var(--shadow); }
.catname {
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--soft);
    color: var(--accent);
    margin: 0;
    padding: 11px 18px;
    font-size: .9rem;
    letter-spacing: .01em;
}
.forum, .topic {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    transition: background-color .16s ease, color .16s ease;
}
.topic:first-child { border-top: 0; }
.forum:last-child, .topic:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.topic:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.forum:hover, .topic:hover { background: var(--hover); }
.forum strong, .topic strong { display: block; overflow-wrap: anywhere; }
.forum small, .topic small { display: block; font-size: .78rem; overflow-wrap: anywhere; }
.forumicon, .bubble, .avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--soft);
    color: var(--accent);
    font-weight: 800;
}
.forumicon::before, .bubble::before {
    content: "";
    width: 15px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 5px 5px 5px 2px;
    background: radial-gradient(circle, currentColor 1px, transparent 1.2px) center / 4px 4px repeat-x;
}
.avatar { border-radius: 50%; }
.row-arrow { flex: none; margin-inline-start: auto; color: var(--muted); font-size: 1.2rem; }
.count + .row-arrow, .thread-meta + .row-arrow { margin-inline-start: 0; }
.count b { color: var(--text); font-weight: 680; }
.count, .badge { white-space: nowrap; font-size: .75rem; }
.count { margin-inline-start: auto; color: var(--muted); }
.thread-meta { margin-inline-start: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.badge { background: var(--soft); color: var(--accent); border-radius: 99px; font-weight: 650; padding: 3px 8px; }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); margin-bottom: 0; }
.stats dt { color: var(--muted); font-size: .78rem; }
.stats dd { margin: 2px 0 0; font-size: 1.65rem; font-weight: 780; }
.sidebar h2 { font-size: .98rem; margin-bottom: 12px; }
.sidebar .stats div { padding: 9px 12px; background: var(--bg); border-radius: 10px; }
.sidebar-empty { margin: 0; font-size: .84rem; }
.latest-link { display: block; padding: 8px 0; overflow-wrap: anywhere; font-size: .86rem; }
.latest-link + .latest-link { border-top: 1px solid var(--border); }
.latest-link small { display: block; }
.btn, .secondary, .iconbtn {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 8px 14px;
    font-weight: 680;
    transition: background-color .16s ease;
}
.btn { color: #fff; background: var(--primary); }
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn.small { font-size: .82rem; }
.secondary, .iconbtn { background: var(--surface); color: var(--text); border-color: var(--border); }
.secondary:hover, .iconbtn:hover { background: var(--hover); }
.iconbtn { width: 38px; justify-content: center; padding: 0; }
.narrow { max-width: 630px; margin-inline: auto; }
label { display: block; font-size: .87rem; font-weight: 640; margin: 12px 0; }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; }
.link { border: 0; background: none; color: inherit; padding: 0; }
.notice { background: var(--soft); padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; }
.error { color: var(--danger); }
.crumb, .empty { color: var(--muted); font-size: .87rem; }
.empty { padding: 12px 18px; }
.crumb a, .member-link { text-decoration: underline; text-underline-offset: .2em; }
.postauthor { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.postauthor small { display: block; }
.postbody { padding-top: 17px; overflow-wrap: anywhere; }
.post-link { margin-inline-start: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.post:target { outline: 2px solid var(--accent); }
.toolbar, .pagination, .admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.pagination a, .admin-nav a { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); }
a[aria-current="page"] { color: var(--accent); background: var(--soft); border-color: var(--accent); }
.profile-card { margin-bottom: 20px; }
.profile-cover { height: clamp(104px, 19vw, 200px); border-radius: var(--radius) var(--radius) 0 0; }
.profile-identity { display: flex; align-items: end; gap: 16px; padding: 0 24px 20px; margin-top: -36px; position: relative; }
.profile-identity .avatar {
    width: 90px;
    height: 90px;
    border: 5px solid var(--surface);
    background: linear-gradient(145deg, #7454de, #4d36a9);
    color: #fff;
    font-size: 2.2rem;
}
.profile-identity h1 { font-size: clamp(1.6rem, 4vw, 2.35rem); margin: 0 0 6px; }
.profile-identity .badge { display: inline-block; max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.panel-title { padding: 16px 20px; margin: 0; }
.profile-empty { display: grid; justify-items: center; padding: 28px 12px; border-top: 1px solid var(--border); color: var(--muted); }
.profile-empty p { margin: 8px 0 0; font-size: .86rem; }
.profile-joined { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 15px; font-size: .82rem; color: var(--muted); }
.profile-joined time { color: var(--text); }
.member-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; }
.member-row + .member-row { border-top: 1px solid var(--border); }
.member-row form { display: flex; flex-wrap: wrap; align-items: end; gap: .45rem; }
.member-row label { margin: 0; }
summary { cursor: pointer; font-weight: 680; }
.foot { padding-block: 18px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }
@media (max-width: 760px) {
    .bar { flex-wrap: wrap; }
    .columns, .admin-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 520px) {
    .wrap { width: calc(100% - 24px); }
    .bar { flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; }
    .bar nav { gap: 8px; }
    .main-nav a { padding: 5px 8px; }
    .account-nav { flex-basis: 100%; margin: 0; }
    .account-nav .iconbtn { margin-inline-start: auto; }
    .page { padding-top: 16px; }
    .profile-identity { padding: 0 14px 15px; margin-top: -25px; gap: 9px; }
    .profile-identity .avatar { width: 68px; height: 68px; border-width: 4px; font-size: 1.6rem; }
    .panel, .post { padding: 14px; }
    .discussion-list, .profile-card { padding: 0; }
    .forum, .topic { padding: 10px 12px; gap: 8px; }
    .forumicon, .bubble { width: 31px; height: 31px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; }
}
