:root {
  color-scheme: dark;
  --bg: #151c1b;
  --surface: #1e2826;
  --surface-soft: #202b29;
  --line: #3a4742;
  --text: #e8ece5;
  --muted: #b3c0b5;
  --accent: #d5b985;
  --accent-light: #f0d9ae;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.62 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent-light); text-underline-offset: .18em; }
a:hover { color: #fff1d6; }
h1, h2 {
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.16;
}
h1 { font-size: clamp(2.15rem, 5vw, 3.65rem); }
h2 { font-size: 1.45rem; }
p, h1, h2 { margin-top: 0; }

.top {
  max-width: 1100px;
  margin: auto;
  padding: 19px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.015em;
  text-decoration: none;
  white-space: nowrap;
}
.top nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.top nav > a { color: var(--muted); text-decoration: none; }
.top nav > a:hover { color: var(--accent-light); }
.top form { display: inline; }
.who { color: var(--muted); font-size: .9rem; }

main { max-width: 940px; margin: 0 auto; padding: 36px 28px 90px; }
.hero { padding: 48px 0 34px; }
.hero h1 { max-width: 720px; margin: 16px 0 20px; }
.hero p { max-width: 670px; color: var(--muted); font-size: 1.08rem; }
.eyebrow { color: var(--accent); font-size: .91rem; font-weight: 650; letter-spacing: .015em; }
.button, button {
  display: inline-block;
  padding: 10px 17px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #20231e;
  font: inherit;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { background: var(--accent-light); border-color: var(--accent-light); color: #20231e; }
.secondary { display: inline-block; margin-left: 18px; }
.subtle { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 400; }
.subtle:hover { background: none; color: var(--accent-light); }

.card, .topic, .comment {
  margin: 18px 0;
  padding: 25px 27px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.card.narrow { max-width: 570px; margin: 38px auto; }
.card > p:last-child, .topic > p:last-child, .comment > p:last-child { margin-bottom: 0; }
.topic:hover { border-color: #6a766a; }
.topic h2 { margin: 8px 0 11px; }
.topic h2 a { color: var(--text); text-decoration: none; }
.topic h2 a:hover { color: var(--accent-light); }
.topic p { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.topic-meta { color: var(--muted); font-size: .84rem; line-height: 1.7; }
.topic-meta a { color: var(--accent-light); }
.permalink { font-size: .85rem; text-decoration: none; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid #796849;
  border-radius: 4px;
  color: #e4cfa6;
  background: #3a3529;
  font: 600 .7rem/1.55 system-ui, sans-serif;
  vertical-align: middle;
  letter-spacing: 0;
}
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 38px; flex-wrap: wrap; }
.list-head h2 { margin: 0; }
.list-head h2 span { color: var(--muted); font-family: system-ui, sans-serif; font-size: .95rem; font-weight: 400; }
.sort { display: flex; gap: 8px; flex-wrap: wrap; }
.sort a { padding: 4px 9px; border-bottom: 1px solid transparent; color: var(--muted); font-size: .9rem; text-decoration: none; }
.sort a.active { color: var(--accent-light); border-color: var(--accent); }
.sort a:hover { color: var(--accent-light); }
.profile-intro { margin-bottom: 25px; }
.profile-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.profile-tabs a { padding: 11px 2px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; }
.profile-tabs a.active { border-color: var(--accent); color: var(--text); }
.profile-tabs a:hover { color: var(--accent-light); }
.profile-tabs span { color: var(--muted); font-size: .85rem; }
.page-numbers { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 26px 0; }
.page-numbers a { min-width: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 4px; text-align: center; text-decoration: none; }
.page-numbers a.active { border-color: var(--accent); background: var(--surface-soft); color: var(--text); }
.page-gap { padding: 0 4px; color: var(--muted); }
.empty-list { padding: 18px 0; color: var(--muted); }

label { display: block; margin: 19px 0 15px; font-weight: 620; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #55635c;
  border-radius: 5px;
  background: #151d1c;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 116px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="hidden"] { display: none; }
.human-check { margin: 20px 0; padding: 0; border: 0; }
.human-check legend { font-weight: 620; }
.human-check label { display: flex; align-items: center; gap: 10px; margin: 9px 0 0; font-weight: 400; }
.human-check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; }
.post-body { min-width: 0; }
.post-image { margin: 14px 0 20px; }
.post-image img { display: block; max-width: 100%; max-height: 440px; width: auto; height: auto; border: 1px solid var(--line); border-radius: 5px; }
.comment-branch { margin-top: 20px; }
.branch-toggle { display: inline-block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent-light); cursor: pointer; font-size: .84rem; }
.branch-toggle:hover { border-color: var(--accent); }
.comment-branch[open] .when-closed, .comment-branch:not([open]) .when-open { display: none; }
.comment-children { margin: 12px 0 0 18px; padding-left: 18px; border-left: 2px solid #927c55; min-width: 0; }
.comment-children .comment { min-width: 0; }
.reply { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.reply textarea { min-height: 74px; }
.reply button { padding: 7px 13px; font-size: .9rem; }
.breadcrumb { margin: 8px 0 24px; }
.token { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 5px; background: #111918; word-break: break-all; }
.pagination { display: flex; gap: 22px; margin: 26px 0; }
footer { max-width: 1100px; margin: auto; padding: 25px 28px 50px; border-top: 1px solid var(--line); color: var(--muted); font-size: .87rem; }
footer a { margin-left: 6px; }
.comment:target { border-color: var(--accent); }

.admin-nav { display: flex; gap: 20px; flex-wrap: wrap; margin: 8px 0 36px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.admin-nav a { text-decoration: none; }
.admin-summary { color: var(--muted); }
.admin-row { padding: 19px 0; border-bottom: 1px solid var(--line); }
.admin-row h2 { margin-bottom: 6px; font-size: 1.25rem; }
.admin-row h2 a { color: var(--text); text-decoration: none; }
.admin-row h2 a:hover { color: var(--accent-light); }
.admin-row p { margin-bottom: 7px; color: var(--muted); overflow-wrap: anywhere; }
.admin-row small { color: var(--muted); }
.admin-details { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 9px 16px; margin: 0 0 24px; }
.admin-details dt { color: var(--muted); }
.admin-details dd { margin: 0; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.danger { background: #523735; border-color: #94635c; color: #f5ded9; }
.danger:hover { background: #70433e; border-color: #ad766e; color: #fff; }
.notice { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-soft); }

@media (max-width: 670px) {
  .top { align-items: flex-start; flex-direction: column; padding: 17px 20px; }
  .top nav { justify-content: flex-start; gap: 13px; }
  main { padding: 20px 18px 68px; }
  .hero { padding-top: 30px; }
  .secondary { display: block; margin: 14px 0 0; }
  .card, .topic, .comment { padding: 18px; }
  .comment-children { margin-left: 7px; padding-left: 10px; }
  .admin-details { grid-template-columns: 1fr; gap: 2px; }
  .admin-details dd { margin-bottom: 8px; }
}
