:root {
    --container: 1240px;
    --community-radius: 18px;
    --community-gap: clamp(.85rem, 2vw, 1.35rem);
    --community-border: #362634;
    --community-panel: #181119;
    --community-hover: #241827;
}

.comment-reply { margin-inline-start: clamp(.5rem, 3vw, 2rem); }
.comment-parent { display: inline-block; margin-block: .2rem; color: #ffbdd8; font-size: .85rem; }
.comment-reply-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-left: 2px solid #ff88b9;
    border-radius: 6px;
    background: #281c29;
}
.comment-reply-context[hidden] { display: none; }

.site {
    width: min(var(--container), calc(100% - clamp(24px, 5vw, 76px)));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    min-height: 88px;
}
.topbar .brand { justify-self: start; }
.view { flex: 1 0 auto; min-width: 0; }
.topbar .hotbar {
    grid-column: 2;
    justify-self: center;
    justify-content: center;
    min-width: 0;
    gap: .3rem;
    padding: .36rem;
    border-color: #704456;
    background: #211721;
    box-shadow: 0 7px 24px #0005, inset 0 1px #ffb0ca18;
}
.topbar .hotbar a, .topbar .hotbar button { color: #e8d7e1; }
.topbar .hotbar .nav-link[aria-current] {
    background: #513043;
    color: #fff3fa;
    box-shadow: inset 0 -2px #ff789d;
}
.footer { padding-bottom: 18px; }

.community-home,
.community-forum {
    width: 100%;
    max-width: none;
    margin-inline: auto;
}

.community-home {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: var(--community-gap);
    align-items: start;
}

.community-welcome,
.community-recent,
.forum-sidebar {
    min-width: 0;
    border-radius: var(--community-radius);
    border: 1px solid var(--community-border);
    background-color: var(--community-panel);
}

.community-welcome {
    min-height: 305px;
    display: grid;
    align-content: center;
    padding: clamp(1.35rem, 4vw, 3.2rem);
    background: radial-gradient(at 20% 5%, #482239 0, transparent 70%), var(--community-panel);
}

.community-welcome h1,
.community-heading h1 {
    margin: 0;
    font-size: clamp(1.95rem, 4.2vw, 3.4rem);
    letter-spacing: -.055em;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.community-welcome p,
.community-heading p {
    color: var(--muted);
    line-height: 1.55;
}

.community-welcome .actions { margin-top: 1.2rem; }
.community-recent > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--community-border);
}
.community-recent h2,
.forum-sidebar h2 { margin: 0; font-size: 1.02rem; }
.community-recent > header form { margin: 0; }
.community-recent .forum-go {
    border-color: #824d64;
    background: #39202e;
    color: #ffe4ef;
}
.community-recent .forum-go:hover { background: #502c41; }
.community-recent > p { padding-inline: 1.15rem; }
.community-recent ul { list-style: none; padding: 0; margin: 0; }
.community-recent li + li { border-top: 1px solid var(--line-soft); }
.community-recent li a {
    padding: .8rem 1.15rem;
    display: grid;
    gap: .24rem;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.community-recent li a:hover { background: var(--community-hover); }
.community-recent li span { color: var(--muted); font-size: .82rem; }

.community-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--community-gap);
    margin-bottom: var(--community-gap);
}
.community-heading > div { min-width: 0; }
.community-heading p { margin: .35rem 0 0; }

.forum-layout {
    display: grid;
    grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
    align-items: start;
    gap: var(--community-gap);
}

.forum-sidebar { padding: .85rem; }
.forum-sidebar h2 { padding: .4rem .55rem; }
.forum-category-list { display: grid; gap: .25rem; }
.forum-category-list a {
    text-decoration: none;
    color: var(--muted);
    display: block;
    padding: .57rem .6rem;
    border-radius: 9px;
}
.forum-category-list a:hover,
.forum-category-list a[aria-current] {
    color: var(--ink);
    background: #352439;
}
.forum-saved-link { margin-top: .45rem; border-top: 1px solid var(--community-border); }

.forum-feed { min-width: 0; }
.forum-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(8rem, auto) auto;
    gap: .55rem;
}
.forum-search input,
.forum-search select,
.field select {
    min-width: 0;
    width: 100%;
    min-height: 42px;
    padding: .55rem .65rem;
    color: var(--ink);
    border: 1px solid #554052;
    border-radius: 9px;
    background: #1d151e;
}
.forum-feed .filter-tabs { margin: .75rem 0; }
.community-thread {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: .8rem;
}
.community-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
}
.community-thread .thread-top,
.community-thread .thread-meta {
    min-width: 0;
    flex-wrap: wrap;
}
.community-thread .thread-title,
.thread-byline h1,
.comment-text {
    min-width: 0;
    overflow-wrap: anywhere;
}
.forum-thread-counts {
    text-align: right;
    white-space: nowrap;
    display: grid;
    gap: .26rem;
    font-size: .76rem;
    color: var(--muted);
}
.forum-topic-meta,
.forum-topic-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .9rem;
}
.forum-topic-meta .muted { font-size: .78rem; }
.forum-topic-actions form { margin: 0; }
.forum-topic-actions button[aria-pressed=true] {
    color: #ffd2e4;
    border-color: #9c536f;
    background: #4a273b;
}
.thread-header { min-width: 0; flex-wrap: wrap; }
.thread-byline { min-width: 0; flex: 1 1 16rem; }
.thread-text { overflow-wrap: anywhere; }
.media-grid > *, .comment-body, .user-main { min-width: 0; overflow-wrap: anywhere; }

.upload-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .55rem;
    align-items: center;
    color: var(--muted);
}
.upload-progress label { grid-column: 1 / -1; }
.upload-progress progress { width: 100%; accent-color: var(--accent); }
.upload-progress button { justify-self: start; }

@media (max-width: 860px) {
    .topbar { grid-template-columns: minmax(0, 1fr); align-content: center; padding-block: .6rem; gap: .55rem; }
    .topbar .hotbar { grid-column: 1; flex-wrap: wrap; overflow: visible; }
    .community-home { grid-template-columns: minmax(0, 1fr); }
    .community-welcome { min-height: 230px; }
}

@media (max-width: 660px) {
    .topbar .hotbar { width: 100%; margin: 0; flex-wrap: wrap; overflow: visible; }
    .topbar .hotbar a, .topbar .hotbar button { padding: .4rem .65rem; min-height: 34px; }
    .forum-layout { grid-template-columns: minmax(0, 1fr); }
    .forum-category-list { display: flex; flex-wrap: wrap; }
    .forum-category-list a { padding: .38rem .55rem; }
    .forum-saved-link { margin: 0; border-top: 0; }
    .forum-search { grid-template-columns: minmax(0, 1fr) auto; }
    .forum-search input { grid-column: 1 / -1; }
    .community-thread { grid-template-columns: auto minmax(0, 1fr); }
    .forum-thread-counts { grid-column: 2; display: flex; gap: .65rem; text-align: left; }
    .community-heading .button { min-height: 40px; }
}

.view { animation: none; }

/* Align page headings and repeated action rows across account and admin screens. */
.page-head {
    align-items: center;
    row-gap: .85rem;
}
.page-head > div,
.panel-top > div,
.account-data dd {
    min-width: 0;
    overflow-wrap: anywhere;
}
.account-actions {
    align-items: baseline;
}
.admin-user-list .user-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) max-content;
    gap: .75rem;
}
.admin-user-list .user-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .45rem;
}
.user-card-actions form { margin: 0; }
.user-card-actions .button { white-space: normal; }
.form-row .field { min-width: 0; }
.invite-main { min-width: 0; }
.invite-code { max-width: 100%; overflow-wrap: anywhere; }
.media-grid .player-info strong { overflow-wrap: anywhere; }
.upload-progress [data-upload-percent] { text-align: right; }

@media (max-width: 820px) {
    .page-head { align-items: flex-start; }
}
@media (max-width: 640px) {
    .admin-user-list .user-card {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }
    .admin-user-list .user-card-actions {
        grid-column: 2;
        justify-content: flex-start;
    }
    .admin-user-list .user-card-actions:empty { display: none; }
    .auth-panel { min-width: 0; }
    .topbar .brand > span:last-child { display: inline; }
}
