:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e4e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 24px;
  margin: 12px 0;
}

h2 {
  font-size: 18px;
  margin: 0;
}

h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.muted {
  color: var(--muted);
}

#site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
  color: var(--primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  color: var(--text);
  font-weight: 600;
}

.nav-link {
  color: var(--text);
  font-size: 14px;
}

.lang-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.container.narrow {
  max-width: 460px;
}

section {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.board-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: inherit;
}

.board-card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}

.board-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.board-desc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
  min-height: 20px;
}

.board-meta {
  color: var(--muted);
  font-size: 12px;
}

.topic-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.topic-row:last-child {
  border-bottom: none;
}

.topic-main {
  min-width: 0;
}

.topic-title {
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-title:hover {
  color: var(--primary);
  text-decoration: none;
}

.topic-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.topic-stats {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.6;
}

.badge-pin {
  background: #fef3c7;
  color: #92400e;
}

.badge-lock {
  background: #e5e7eb;
  color: #374151;
}

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  border-color: #fca5a5;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-small {
  padding: 4px 10px;
  font-size: 13px;
}

.form label {
  display: block;
  font-size: 13px;
  margin: 12px 0 4px;
  color: var(--text);
}

.form input,
.form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form textarea {
  resize: vertical;
}

.form-actions {
  margin-top: 14px;
}

.form-message,
#form-message,
#board-form-message {
  margin-top: 10px;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.message.muted {
  color: var(--muted);
}

.message.error {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.topic h1 {
  margin-top: 0;
}

.topic-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 16px 0;
}

.topic-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.topic-flags {
  display: flex;
  gap: 6px;
}

.reply {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.reply-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.reply-author {
  font-weight: 600;
}

.reply-date {
  color: var(--muted);
}

.reply-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-actions {
  margin-top: 8px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.page-info {
  color: var(--muted);
  font-size: 13px;
}

.admin-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.admin-row:last-child {
  border-bottom: none;
}

.admin-row-title {
  font-weight: 600;
  color: var(--text);
}

.admin-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.admin-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-search input {
  flex: 1;
  max-width: 320px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}

.admin-table th {
  background: #f9fafb;
  color: var(--muted);
  font-weight: 600;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.user-name {
  font-weight: 600;
}

.user-email {
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

#toast.visible {
  opacity: 1;
}

.toast {
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.toast.error {
  background: var(--danger);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px;
}
