:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #d9deea;
  --brand: #2557d6;
  --brand-dark: #173b98;
  --danger: #aa2424;
  --ok: #155724;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px clamp(16px, 4vw, 48px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); }
.site-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.container { width: min(1100px, calc(100% - 32px)); margin: 28px auto; }
.card, .hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(16px, 3vw, 28px);
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.hero { background: linear-gradient(135deg, #fff, #eef3ff); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.button:hover, button:hover { background: var(--brand-dark); text-decoration: none; }
.button.secondary { background: #eef2ff; color: var(--brand-dark); }
.inline-form { display: inline; }
.inline-form button { padding: 4px 8px; font-size: .9rem; }
label { display: grid; gap: 6px; margin: 12px 0; font-weight: 650; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
.forum-list, .topic-list { display: grid; gap: 10px; }
.forum-row, .topic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.topic-row.pinned { border-color: #a9bfff; background: #f8faff; }
.forum-row h3, .topic-row h3 { margin: 0 0 4px; }
.forum-row p, .topic-row p { margin: 0; }
.stats { display: grid; gap: 4px; text-align: right; color: var(--muted); white-space: nowrap; }
.meta, .muted { color: var(--muted); font-size: .95rem; }
.breadcrumb { color: var(--muted); }
.notice {
  background: #fff8e5;
  border: 1px solid #f2d28b;
  border-radius: 10px;
  padding: 10px 12px;
}
.flash {
  width: min(1100px, calc(100% - 32px));
  margin: 16px auto 0;
  border: 1px solid #b7dfc0;
  background: #eaf8ee;
  color: var(--ok);
  border-radius: 12px;
  padding: 12px 14px;
}
.flash.error { border-color: #e9b5b5; background: #fff0f0; color: var(--danger); }
.post header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 14px;
  padding-bottom: 10px;
}
.post-body p { margin: 0 0 1em; }
.tags a {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2ff;
  margin: 0 4px 4px 0;
}
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pagination a, .pagination span {
  min-width: 36px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
}
.pagination span { background: var(--brand); color: #fff; border-color: var(--brand); }
.compact-list { display: grid; gap: 12px; padding-left: 20px; }
.moderation summary { cursor: pointer; color: var(--muted); }
.moderation form { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.search-results { margin-top: 16px; display: grid; gap: 10px; }
.site-footer { text-align: center; color: var(--muted); padding: 32px 16px; }
@media (max-width: 720px) {
  .forum-row, .topic-row { grid-template-columns: 1fr; }
  .stats { text-align: left; }
  .post header { display: block; }
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.stats-grid .card { margin: 0; }
.stats-grid strong { display: block; font-size: 1.4rem; }
.stats-grid span { color: var(--muted); }
.author-list { display: grid; gap: 8px; }
.author-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  background: #eef2ff;
  border: 1px solid var(--border);
}
.avatar.large { width: 84px; height: 84px; float: right; margin-left: 16px; }
.post-header { justify-content: flex-start !important; align-items: center; }
.edit-box { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 10px; }
.edit-box summary { cursor: pointer; color: var(--muted); }
.ellipsis { background: transparent !important; color: var(--muted) !important; border-color: transparent !important; }
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: 1fr; }
  .author-row { display: block; }
}
