:root {
    --bg: #0d0f0e;
    --surface: #151816;
    --surface-raised: #1b1f1c;
    --line: #2b302d;
    --line-strong: #3c443f;
    --text: #edf1ee;
    --muted: #9aa39d;
    --accent: #b9f47b;
    --accent-strong: #99dc58;
    --accent-soft: #1e2d18;
    --danger: #ff958c;
    --danger-bg: #2a1817;
    --onion: #d7a6ef;
    --max-width: 780px;
    --radius: 14px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 5px;
}

button, input, textarea, select { font: inherit; }

button, .button {
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface-raised);
    color: var(--text);
    padding: .65rem .9rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 650;
}

.button:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #11170d; }
.button.primary:hover { background: var(--accent-strong); color: #11170d; }
.button.subtle { padding: .45rem .7rem; font-size: .9rem; }
.button.danger { border-color: #744540; background: var(--danger-bg); color: var(--danger); }
.button.danger:hover { border-color: var(--danger); color: #ffd3cf; }

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #101310;
    color: var(--text);
    padding: .8rem .9rem;
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(185 244 123 / 10%);
}

textarea { resize: vertical; min-height: 7rem; }
label { font-weight: 650; }
label small { display: block; color: var(--muted); font-weight: 400; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: rgb(13 15 14 / 94%);
    backdrop-filter: blur(14px);
}

.header-inner {
    width: min(calc(100% - 2rem), 1040px);
    margin: auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -.02em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    color: var(--onion);
    font-size: 16px;
}

nav { display: flex; align-items: center; gap: 1rem; }
nav a { font-size: .92rem; text-decoration: none; color: var(--muted); }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }
.nav-accent { color: var(--accent) !important; }
.inline-form { display: inline; }
.nav-button { padding: 0; border: 0; background: transparent; color: var(--muted); font-weight: 400; }

.page-shell {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 3rem auto 5rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
}

.site-footer > div { width: min(calc(100% - 2rem), var(--max-width)); margin: auto; padding: 2rem 0; }
.footer-separator { margin: 0 .5rem; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.hero { padding: clamp(1.3rem, 4vw, 2.25rem); }
.hero h1 { margin: 0; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.05; letter-spacing: -.045em; }
.hero-copy { margin: .65rem 0 1.6rem; color: var(--muted); font-size: 1.05rem; }
.eyebrow { margin: 0 0 .55rem; color: var(--accent); font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.composer textarea { background: #101310; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .75rem; }
.identity-note { color: var(--muted); font-size: .85rem; }
.identity-note strong { color: var(--text); }

.feed, .discussion { margin-top: 3rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-heading h1, .section-heading h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.025em; }
.sort-tabs { gap: .3rem; padding: .2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.sort-tabs a { padding: .35rem .65rem; border-radius: 7px; }
.sort-tabs a[aria-current="page"] { background: var(--surface-raised); color: var(--text); }

.post-list, .profile-comments { display: grid; gap: .8rem; }
.post-card { padding: 1.15rem; }
.post-meta { display: flex; align-items: center; gap: .65rem; margin-bottom: .9rem; }
.post-meta > div { display: flex; flex-direction: column; }
.avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .86rem;
    font-weight: 800;
    object-fit: cover;
    border: 1px solid rgb(255 255 255 / 7%);
}
.avatar-large { width: 72px; height: 72px; font-size: 1.45rem; }
.anon-avatar-1 { background: #21331b; color: #b9f47b; }
.anon-avatar-2 { background: #2f2235; color: #dea5f3; }
.anon-avatar-3 { background: #182e32; color: #83e1ec; }
.anon-avatar-4 { background: #38251c; color: #f1bd83; }
.anon-avatar-5 { background: #202640; color: #aebcff; }
.anon-avatar-6 { background: #3b2028; color: #ff9bb5; }
.anon-avatar-7 { background: #303018; color: #e5e27c; }
.anon-avatar-8 { background: #1d3030; color: #8fddd1; }
.default-avatar {
    background: radial-gradient(circle at 65% 30%, #3d5231 0 14%, #26371f 15% 39%, #1c2918 40%);
    color: var(--accent);
}
.author { font-weight: 750; text-decoration: none; }
.anonymous { color: #c5d9b0; }
time { color: var(--muted); font-size: .78rem; }
.user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions, .comment-actions {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--muted);
    font-size: .83rem;
}
.post-actions a, .comment-actions a { text-decoration: none; }
.post-actions > a { text-decoration: none; }

.report-control > summary, .reply-control > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.report-control > summary::-webkit-details-marker,
.reply-control > summary::-webkit-details-marker { display: none; }
.report-control[open] > summary, .reply-control[open] > summary { color: var(--accent); }
.compact-form {
    display: grid;
    gap: .55rem;
    width: min(360px, calc(100vw - 4rem));
    margin-top: .65rem;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text);
}
.compact-form label { font-size: .78rem; }
.compact-form input, .compact-form textarea { margin-top: .25rem; min-height: auto; }
.compact-form button { justify-self: start; }

.back-link { margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.comment-composer { padding: 1rem; }
.comment-composer > label { display: block; margin-bottom: .55rem; }
.count { color: var(--muted); font-size: .75em; font-weight: 500; }

.comments { display: grid; gap: .6rem; margin-top: 1.2rem; }
.comment {
    border-left: 1px solid var(--line-strong);
    padding: .7rem 0 .2rem .85rem;
}
.comment > summary {
    cursor: pointer;
    color: var(--muted);
    font-size: .82rem;
    list-style-position: outside;
}
.comment > summary {
    align-items: center;
    gap: .55rem;
}
.comment[open] > summary { display: flex; }
.comment > summary .avatar { display: inline-grid; vertical-align: middle; margin-right: .4rem; width: 28px; height: 28px; font-size: .72rem; }
.comment > summary img.avatar { display: inline-block; }
.comment > summary::marker { color: var(--accent); }
.comment-summary-main { display: inline-flex; align-items: baseline; gap: .45rem; }
.hidden-count { margin-left: .5rem; color: var(--muted); }
.comment[open] > summary .hidden-count { display: none; }
.comment-content { padding-top: .55rem; }
.comment-actions { margin-top: .65rem; }
.comment-children { margin-left: 1rem; }
.comment.depth-5 .comment-children { margin-left: 0; }
.comment:target { border-left-color: var(--accent); }
.deleted-content { border-style: dashed; }
.deleted-placeholder { color: var(--muted); font-style: italic; }
.muted-notice { color: var(--muted); background: var(--surface); border-color: var(--line); }

.empty-state { padding: 2rem; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 0 0 .25rem; color: var(--text); }
.empty-state p { margin: 0; }
.pagination { justify-content: space-between; margin-top: 1.2rem; color: var(--muted); }

.auth-card, .prose, .error-page { max-width: 560px; margin: 5rem auto; padding: clamp(1.3rem, 5vw, 2.3rem); }
.auth-card h1, .prose h1, .error-page h1 { margin: 0; font-size: 2.2rem; line-height: 1.1; }
.auth-card > p:not(.eyebrow), .lead { color: var(--muted); }
.stacked-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.stacked-form label { display: grid; gap: .35rem; }
.stacked-form button { justify-self: start; }
.auth-footnote { margin: 1.3rem 0 0; font-size: .9rem; }
.form-error, .notice {
    margin: 1rem 0;
    padding: .75rem .9rem;
    border: 1px solid #734440;
    border-radius: 9px;
    background: #2a1817;
    color: var(--danger);
}
.notice { border-color: #3c5631; background: var(--accent-soft); color: var(--accent); }

.profile-header { display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem; }
.profile-header h1 { margin: 0; }
.profile-header p:last-child { margin: .2rem 0 0; color: var(--muted); }
.settings-link { display: inline-block; margin-top: .75rem; }
.profile-grid { display: grid; gap: 2.5rem; margin-top: 2.5rem; }
.mini-comment { padding: 1rem; }
.mini-comment .post-actions { justify-content: space-between; }

.prose { max-width: 700px; }
.prose h2 { margin-top: 2rem; font-size: 1.2rem; }
.prose li { margin: .35rem 0; }
.error-page { text-align: center; }
.error-code { color: var(--accent); font-size: 3rem; font-weight: 850; margin: 0; }
.error-page .button { display: inline-block; margin-top: 1rem; }

.settings-layout { display: grid; gap: 1rem; }
.settings-card { padding: clamp(1.2rem, 4vw, 2rem); }
.settings-card h1, .settings-card h2 { margin-top: 0; }
.settings-card > p { color: var(--muted); }
.avatar-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-top: 1.4rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #101310;
}
.avatar-preview > div { display: grid; gap: .2rem; }
.avatar-preview span { color: var(--muted); font-size: .85rem; }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.context-quote {
    margin: 1.4rem 0;
    padding: 1rem;
    border-left: 2px solid var(--accent);
    background: #101310;
    color: var(--muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.admin-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-header h1 { margin: 0; font-size: clamp(2rem, 6vw, 3rem); }
.admin-tabs { display: inline-flex; margin-bottom: 1.25rem; }
.report-list, .audit-list { display: grid; gap: .8rem; }
.admin-report-card, .admin-detail, .moderation-actions, .context-card, .audit-entry { padding: 1.1rem; }
.admin-report-card h2 { margin: .7rem 0 .3rem; font-size: 1.1rem; }
.admin-report-card p { color: var(--muted); }
.report-card-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.status-badge {
    display: inline-flex;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.status-new { background: var(--accent-soft); color: var(--accent); }
.status-resolved { background: #1b2b31; color: #9addeb; }
.status-dismissed { background: #292929; color: #bbb; }
.status-active { background: var(--danger-bg); color: var(--danger); }
.status-reversed { background: var(--accent-soft); color: var(--accent); }
.moderation-notice {
    display: grid;
    gap: .45rem;
    padding: .9rem;
    border: 1px solid #744540;
    border-radius: 10px;
    background: var(--danger-bg);
}
.moderation-notice-top, .decision-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.moderation-notice p, .moderation-notice time { margin: 0; }
.moderation-notice time { color: var(--muted); font-size: .82rem; }
.rule-badge, .version-badge {
    display: inline-flex;
    padding: .16rem .45rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 800;
}
.version-badge { color: var(--muted); }
.rule-list { display: grid; gap: .8rem; }
.rule-item { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.rule-item h3 { margin: .55rem 0 .25rem; }
.rule-item p { margin: 0; }
.decision-card, .review-history { padding: clamp(1.2rem, 4vw, 2rem); }
.decision-heading h1 { margin: .2rem 0 1.5rem; }
.review-history { margin-top: 1rem; }
.review-history h2 { margin-top: 0; }
.review-history li { margin: .55rem 0; }
.decision-discussion { padding-top: 1rem; border-top: 1px solid var(--line); }
.success-notice { border-color: #3c5631; background: var(--accent-soft); color: var(--accent); }
.address-list { display: grid; gap: .7rem; }
.address-list div { padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
.address-list dt { color: var(--muted); font-size: .8rem; }
.address-list dd { margin: .25rem 0 0; overflow-wrap: anywhere; }
.admin-detail h1 { margin: .4rem 0 1.5rem; overflow-wrap: anywhere; }
.moderation-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 0; }
.moderation-meta div { padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
.moderation-meta dt { color: var(--muted); font-size: .75rem; }
.moderation-meta dd { margin: .2rem 0 0; }
.moderation-context { margin: 2rem 0; }
.context-card { margin-top: .6rem; }
.context-card .user-text, .context-card .deleted-placeholder { margin-top: .5rem; }
.context-child { margin-left: min(2rem, 5vw); border-left-color: var(--line-strong); }
.target-context { border-color: var(--accent); }
.action-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.audit-entry {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .3rem 1rem;
}
.audit-entry > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.audit-entry span { color: var(--muted); }
.audit-entry p { grid-column: 1 / -1; margin: .4rem 0 0; color: var(--muted); }

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

@media (max-width: 640px) {
    .site-header { position: static; }
    .header-inner { min-height: auto; padding: .85rem 0; align-items: flex-start; }
    .brand span:last-child { display: none; }
    .header-inner nav {
        flex: 1;
        min-width: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: .5rem .8rem;
    }
    .page-shell { margin-top: 1.5rem; width: min(calc(100% - 1rem), var(--max-width)); }
    .composer-footer, .section-heading { align-items: stretch; flex-direction: column; }
    .composer-footer .button { width: 100%; }
    .sort-tabs { align-self: flex-start; }
    .comment-children { margin-left: .45rem; }
    .post-actions, .comment-actions { flex-wrap: wrap; }
    .profile-header { align-items: flex-start; }
    .admin-header { align-items: stretch; flex-direction: column; }
    .moderation-meta { grid-template-columns: 1fr; }
    .decision-heading, .moderation-notice-top { flex-direction: column; }
    .action-row { display: grid; }
    .action-row .button { width: 100%; }
    .audit-entry { grid-template-columns: 1fr; }
    .footer-separator { display: none; }
    .site-footer span, .site-footer a { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
