:root {
  --ink: #14232b;
  --muted: #5c6d76;
  --paper: #f4efe4;
  --card: #fffdf8;
  --line: #d7cbb8;
  --accent: #c45c26;
  --sea: #1b4d5c;
  --header: #10262e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }
.wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-header {
  background: var(--header);
  color: #f4efe4;
  padding: 14px 0;
}
.header-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo-mark {
  border: 1px solid #e2c9a5;
  padding: 4px 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
}
.logo-text { font-weight: 650; }
.search-form { display: flex; flex: 1; min-width: 180px; gap: 6px; }
.search-form input,
.auth-form input,
.auth-form textarea,
.reply-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}
.search-form button {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
}
.user-nav { display: flex; gap: 14px; align-items: center; }
.user-nav a { color: #f4efe4; }
.btn-nav { border: 1px solid #e2c9a5; padding: 4px 10px; }

main.wrap { padding: 28px 0 64px; }
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 32px;
  color: var(--muted);
  font-size: 14px;
}

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 32px; margin: 0 0 8px; letter-spacing: -0.03em; }
.lede, .hero p, .muted { color: var(--muted); }

.forum-group { margin-bottom: 32px; }
.forum-group h2,
h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}
.forum-table, .topic-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
}
.forum-table th, .topic-table th,
.forum-table td, .topic-table td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: top;
  border-top: 1px solid var(--line);
}
.forum-table th, .topic-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-top: 0;
}
.forum-name { font-weight: 650; font-size: 16px; }
.forum-desc { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.crumbs { display: flex; gap: 8px; color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.btn, button.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: 0;
  padding: 9px 14px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.btn:hover { color: white; text-decoration: none; filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--sea); border: 1px solid var(--line); }
.tag {
  display: inline-block;
  background: #ead9c4;
  color: var(--ink);
  font-size: 11px;
  padding: 1px 6px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-lock { background: #d9cfc3; }

.post {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.post-meta {
  padding: 16px;
  background: #efe6d6;
  border-right: 1px solid var(--line);
}
.post-body { padding: 16px 18px 12px; }
.author { font-weight: 700; display: block; margin-bottom: 6px; }
.content { overflow-wrap: anywhere; }
.content .quote {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #f7f1e6;
}
.content .quote cite { display: block; font-style: normal; font-weight: 650; margin-bottom: 6px; }
.content pre {
  background: #132228;
  color: #f4efe4;
  padding: 12px;
  overflow: auto;
}
.post-img, .attach-img { max-width: 100%; height: auto; }
.post-signature {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.post-signature .quote { background: #fbf7f0; }
.post-actions { margin-top: 12px; display: flex; gap: 12px; font-size: 13px; }
.post-hidden { opacity: 0.75; }
.attachments { list-style: none; padding: 12px 0 0; margin: 0; }
.missing { color: #9a3412; }
.inline { display: inline; }
.inline button {
  background: none;
  border: 0;
  color: var(--sea);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.reply-box, .auth-form {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 16px;
}
.auth-form { max-width: 460px; display: grid; gap: 10px; }
.auth-form label { display: grid; gap: 4px; }
.error { color: #9a3412; margin: 0; }
.flashes { list-style: none; padding: 0; }
.flash { padding: 10px 12px; border: 1px solid var(--line); background: var(--card); margin-bottom: 8px; }
.flash-success { border-color: #7a9e6b; }
.flash-error { border-color: #c45c26; }
.pagination { display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.empty { color: var(--muted); }
.search-results { list-style: none; padding: 0; }
.search-results li {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.profile-dl { display: grid; gap: 8px; }
.profile-dl div { display: flex; gap: 16px; }
.profile-dl dt { width: 120px; color: var(--muted); }

/* profile header */
.profile-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.tag-admin { background: #d1e8d4; color: #1a5c28; }
.tag-ban   { background: #f8d7d7; color: #8b1a1a; }
.btn-danger { background: #9a3412; }
.btn-danger:hover { background: #7f2a0e; }

/* post edit/delete actions — inline buttons look like links */
.post-actions form.inline button { color: #9a3412; }
.post-actions form.inline button:hover { text-decoration: underline; }

/* admin topic-table controls */
.admin-col { width: 70px; text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-btn {
  background: none;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.4;
}
.row-btn:hover { background: #ede5d8; }
.row-btn-danger:hover { background: #f8d7d7; border-color: #c45c26; }

/* PM badge */
.pm-link { position: relative; }
.pm-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  margin-left: 3px;
  vertical-align: middle;
}
.pm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pm-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.pm-tabs a { padding: 8px 18px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.pm-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pm-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.pm-table th, .pm-table td { padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.pm-table th { font-size: 12px; text-transform: uppercase; color: var(--muted); border-top: 0; }
.pm-unread td:first-child a { font-weight: 700; }
.pm-unread { background: #f9f4ec; }
.btn-sm { padding: 4px 8px; font-size: 13px; }

/* BBCode editor toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #efe6d6;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 6px 8px;
}
.ed-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
}
.ed-btn:hover { background: #e2d9cc; }
.ed-sep { width: 1px; background: var(--line); margin: 2px 4px; }
.ed-preview {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.ed-preview:hover { filter: brightness(1.1); }
.editor-preview {
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fffdf8;
  padding: 12px 16px;
  min-height: 60px;
}

/* file upload */
.upload-row { margin-top: 8px; }
.upload-label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.file-input { font: inherit; }
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 10px;
  font: inherit;
}
.settings-grid { display: grid; gap: 6px; }
.settings-help { margin-top: -2px; }
.settings-passwords {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .post { grid-template-columns: 1fr; }
  .post-meta { border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-passwords { grid-template-columns: 1fr; }
  .forum-table th:nth-child(2),
  .forum-table td:nth-child(2),
  .forum-table th:nth-child(3),
  .forum-table td:nth-child(3) { display: none; }
}
