:root {
  --ink: #2a2020;
  --paper: #fffaf0;
  --white: #fff;
  --line: #e5c9c5;
  --muted: #685957;
  --accent: #d71920;
  --accent-dark: #a70c18;
  --yellow: #ffd400;
  --soft: #fff2a3;
  --success: #176b4b;
  --danger: #a70c18;
  --shadow: 0 16px 40px rgba(111, 13, 20, .11);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; line-height: 1.55; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; background: var(--ink); color: #fff; padding: .65rem 1rem; }
.skip-link:focus { top: 1rem; }

.site-header { min-height: 82px; padding: 0 max(1.25rem, calc((100vw - 1120px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 2rem; background: var(--white); border-bottom: 5px solid var(--yellow); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 900; letter-spacing: -.04em; box-shadow: inset -6px -6px 0 var(--yellow); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .74rem; }
nav { display: flex; align-items: center; gap: 1.35rem; }
nav a { text-decoration: none; font-size: .92rem; font-weight: 700; }
nav a[aria-current="page"] { color: var(--accent-dark); }
.nav-toggle { display: none; }

main { min-height: calc(100vh - 230px); }
main:focus { outline: none; }
.page { width: min(1120px, calc(100% - 2.5rem)); margin: 0 auto; padding: 3.5rem 0 5rem; }
.narrow { width: min(760px, calc(100% - 2.5rem)); }
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 2rem; align-items: stretch; margin-bottom: 2.25rem; }
.hero-copy { padding: 3rem; background: linear-gradient(135deg, #d71920 0%, #a70c18 100%); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero-copy::after { content: "+"; position: absolute; right: 1.2rem; bottom: -3.9rem; color: rgba(255, 212, 0, .16); font: 900 14rem/1 ui-sans-serif, system-ui, sans-serif; }
.eyebrow { margin: 0 0 .8rem; color: var(--accent); font-size: .76rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.hero-copy .eyebrow { color: var(--yellow); }
h1, h2, h3 { line-height: 1.14; letter-spacing: -.025em; }
h1 { margin: 0 0 1rem; max-width: 720px; font-size: clamp(2.15rem, 5vw, 4.4rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2.15rem); }
h3 { font-size: 1.15rem; }
.hero-copy > p:not(.eyebrow) { max-width: 650px; margin: 0; color: #fff8f4; font-size: 1.08rem; }
.identity-card { padding: 2rem; background: var(--white); border: 1px solid var(--line); border-top: 7px solid var(--yellow); border-radius: var(--radius); box-shadow: var(--shadow); }
.identity-card h2 { margin: 0 0 .35rem; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }
.alias { margin: .5rem 0 1rem; font-size: 1.55rem; font-weight: 900; color: var(--accent-dark); }
.identity-card p:last-child { margin-bottom: 0; }
.identity-actions { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.identity-reset { color: var(--accent-dark); font-weight: 900; }
.identity-reset-help { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.identity-reset-message { margin: .65rem 0 0; color: var(--success); font-size: .82rem; font-weight: 800; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 2rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.thread-list { display: grid; gap: .85rem; }
.thread-card { display: block; padding: 1.5rem; color: inherit; text-decoration: none; background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.thread-card:hover { transform: translateY(-2px); color: var(--ink); border-left-color: var(--accent-dark); box-shadow: var(--shadow); }
.thread-card h3 { margin: 0 0 .45rem; }
.thread-card p { margin: 0 0 1rem; color: #344256; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); font-size: .82rem; }
.meta strong { color: var(--ink); }

.panel { padding: 1.75rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin-top: 0; }
label { display: block; margin: 1rem 0 .35rem; font-size: .87rem; font-weight: 800; }
input, textarea { width: 100%; border: 1px solid #9da8b4; border-radius: 7px; background: #fff; color: var(--ink); padding: .72rem .8rem; }
textarea { min-height: 145px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(215, 25, 32, .3); outline-offset: 2px; }
.char-count { display: block; margin-top: .25rem; color: var(--muted); text-align: right; font-size: .75rem; }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: .65rem; align-items: start; margin-top: 1rem; font-weight: 500; }
.check-row input { width: auto; margin-top: .3rem; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; border: 0; border-radius: 7px; padding: .65rem 1rem; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; text-decoration: none; }
.button:hover { background: var(--accent-dark); color: #fff; }
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary { border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.button.danger { background: var(--danger); }
.button.approve { background: var(--success); }
.form-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.1rem; }
.form-message { min-height: 1.5em; margin: .75rem 0 0; color: var(--success); font-weight: 700; font-size: .88rem; }
.form-message.error { color: var(--danger); }
.muted { color: var(--muted); }
.notice { padding: 1rem 1.15rem; border-left: 6px solid var(--accent); background: var(--yellow); color: #2a2020; }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed #9da8b4; border-radius: var(--radius); background: rgba(255,255,255,.45); }

.thread-view { display: grid; gap: 1.5rem; }
.back-link { display: inline-block; margin-bottom: 1.2rem; font-weight: 800; text-decoration: none; }
.post { padding: 2rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.post h1 { color: var(--ink); font-size: clamp(2rem, 4vw, 3.35rem); }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.redacted { display: inline; border-radius: 2px; background: #151515; color: #151515; user-select: none; }
.post-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.text-button { border: 0; padding: .25rem 0; background: none; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.comment-list { display: grid; gap: .8rem; }
.comment { padding: 1.25rem; border-left: 4px solid #92a0b0; background: var(--white); }
.comment .meta { margin-bottom: .65rem; }

.prose h1 { font-size: clamp(2.3rem, 5vw, 4rem); }
.prose h2 { margin: 2.5rem 0 .65rem; }
.prose h3 { margin-top: 1.7rem; }
.prose p, .prose li { color: #344256; }
.prose li + li { margin-top: .5rem; }
.prose .lead { font-size: 1.2rem; color: var(--ink); }
.step-list { counter-reset: steps; padding: 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 2.4rem 1fr; gap: .8rem; margin: 1rem 0; }
.step-list li::before { counter-increment: steps; content: counter(steps); width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 900; }

.admin-columns { display: grid; gap: 2rem; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.5rem 0 .75rem; }
.stat-card { min-width: 0; padding: 1.15rem; border: 1px solid var(--line); border-top: 6px solid var(--yellow); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card strong, .stat-card span, .stat-card small { display: block; }
.stat-card strong { color: var(--accent-dark); font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.stat-card span { margin-top: .55rem; color: var(--ink); font-weight: 900; }
.stat-card small { margin-top: .25rem; color: var(--muted); line-height: 1.35; }
.stats-note { margin: 0 0 2rem; color: var(--muted) !important; font-size: .82rem; }
.admin-password-panel { margin: 0 0 2.25rem; border-top: 6px solid var(--accent); }
.admin-password-panel h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
.admin-item { margin: 1rem 0; padding: 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-item h3 { margin-bottom: .4rem; }
.admin-item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-item .redaction-field { margin-bottom: .35rem; background: #fffdf7; line-height: 1.55; }
.admin-item textarea.redaction-field { min-height: 125px; }
.redact-action { display: inline-block; margin: 0 0 .5rem; color: var(--accent-dark); font-weight: 800; }
.redaction-message { min-height: 1.4em; margin: .65rem 0 0; color: var(--success); font-size: .84rem; font-weight: 700; }
.redaction-message.error { color: var(--danger); }
.reported-content { margin: 1rem 0; padding: .9rem 1rem; border-left: 4px solid var(--accent); background: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: .18rem .5rem; border-radius: 999px; background: var(--soft); font-size: .74rem; font-weight: 800; }

dialog { width: min(520px, calc(100% - 2rem)); padding: 1.5rem; border: 0; border-radius: var(--radius); color: var(--ink); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(10, 21, 36, .68); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-head h2 { margin: 0; }
.icon-button { border: 0; background: none; font-size: 2rem; cursor: pointer; }

.loading-state { width: min(1120px, calc(100% - 2.5rem)); margin: 4rem auto; color: var(--muted); }
.error-page { text-align: center; padding-top: 7rem; }
footer { padding: 2rem max(1.25rem, calc((100vw - 1120px) / 2)); background: var(--accent-dark); color: #fff8f4; border-top: 6px solid var(--yellow); font-size: .83rem; }
footer p { margin: .25rem 0; }
footer a { color: #fff; }

@media (max-width: 820px) {
  .hero, .home-grid { grid-template-columns: 1fr; }
  .hero-copy { padding: 2rem; }
  .home-grid > aside { order: -1; }
  .nav-toggle { display: block; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: .45rem .7rem; font-weight: 800; }
  nav { display: none; position: absolute; z-index: 10; top: 75px; right: 1.25rem; width: min(290px, calc(100% - 2.5rem)); padding: 1rem; align-items: stretch; flex-direction: column; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
  nav.open { display: flex; }
  nav a { padding: .4rem; }
}

@media (max-width: 520px) {
  .site-header { min-height: 72px; }
  .brand small { display: none; }
  .page, .narrow { width: min(100% - 1.5rem, 1120px); padding-top: 2rem; }
  .hero-copy, .identity-card, .panel, .post { padding: 1.35rem; }
  .post-footer { align-items: flex-start; flex-direction: column; }
  .admin-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
