﻿:root {
  --bg: #edf2f1;
  --surface: #ffffff;
  --text: #1f2a2e;
  --muted: #6b7a80;
  --border: #dce5e3;
  --border-strong: #c3d5d2;
  --accent: #0f766e;
  --accent-strong: #0a5c55;
  --accent-soft: #e5f4f2;
  --accent-grad: linear-gradient(135deg, #0f766e, #14b8a6);
  --danger: #b42318;
  --danger-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(16,24,28,.05), 0 1px 3px rgba(16,24,28,.08);
  --shadow-md: 0 6px 18px rgba(16,24,28,.10);
  --shadow-lg: 0 14px 40px rgba(16,24,28,.18);
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(20,184,166,.07), transparent 40%),
                    radial-gradient(circle at 85% 10%, rgba(15,118,110,.06), transparent 35%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}
::selection { background: rgba(15,118,110,.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3d2cf; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a9bdba; }
::-webkit-scrollbar-track { background: transparent; }

button, input, textarea, select { font: inherit; }
button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
button:hover { border-color: var(--accent); color: var(--accent-strong); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid rgba(15,118,110,.45);
  outline-offset: 1px;
}
button.primary {
  background: var(--accent-grad);
  border: 0;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(15,118,110,.28);
}
button.primary:hover { background: var(--accent-strong); color: #fff; box-shadow: 0 4px 10px rgba(15,118,110,.34); }
button.danger { color: var(--danger); border-color: #efc7c3; background: #fff; }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
button.link { border: 0; background: transparent; color: var(--accent-strong); padding: 4px 0; }
button.link:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  border: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  background: transparent;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-grad);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(15,118,110,.3);
}
.brand-text { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.nav { display: flex; gap: 6px; background: var(--bg); padding: 3px; border-radius: 10px; }
.nav button { border: 0; background: transparent; border-radius: 8px; padding: 6px 14px; color: var(--muted); }
.nav button:hover { color: var(--accent-strong); background: rgba(255,255,255,.8); }
.nav button.active { background: var(--surface); color: var(--accent-strong); font-weight: 600; box-shadow: var(--shadow-sm); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-name { color: var(--accent-strong); font-size: 13.5px; font-weight: 600; background: var(--accent-soft); padding: 5px 12px; border-radius: 20px; }
/* ---------- 内容区 ---------- */
.content {
  max-width: 960px;
  margin: 22px auto 40px;
  padding: 0 18px;
}
.view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  animation: viewIn .22s ease;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.view-head h1 { font-size: 22px; margin: 0; }
.view-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; }
.section-title h2 { font-size: 17px; margin: 0; }
.count-badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

/* ---------- 帖子列表 ---------- */
.thread-list { display: flex; flex-direction: column; gap: 10px; }
.thread-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "avatar title time" "avatar meta meta" "avatar excerpt excerpt";
  gap: 2px 12px;
  align-items: start;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease, background .15s ease;
  background: var(--surface);
}
.thread-row:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); background: #fbfefd; }
.avatar {
  grid-area: avatar;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.thread-title { grid-area: title; font-weight: 650; font-size: 15.5px; color: var(--text); align-self: center; }
.thread-time { grid-area: time; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.thread-meta { grid-area: meta; color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-excerpt { grid-area: excerpt; color: var(--muted); font-size: 13.5px; margin-top: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.role-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 600;
  vertical-align: 1px;
}
.role-badge.admin { background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; }
.role-badge.user { background: #eef1f0; color: var(--muted); }

/* ---------- 帖子详情 ---------- */
.back-link { margin-bottom: 12px; display: inline-block; font-size: 14px; }
.thread-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: #fbfdfc;
  box-shadow: var(--shadow-sm);
}
.thread-detail h1 { font-size: 24px; margin: 6px 0 10px; line-height: 1.35; }
.thread-detail .meta {
  color: var(--muted); font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.thread-detail .meta .avatar { width: 26px; height: 26px; font-size: 12px; }
.thread-detail .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }

/* ---------- 回复 ---------- */
.reply-list { display: flex; flex-direction: column; gap: 10px; }
.reply-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  transition: border-color .15s ease;
}
.reply-item:hover { border-color: var(--border-strong); }
.reply-item .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 7px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reply-item .meta .avatar { width: 24px; height: 24px; font-size: 11px; }
.reply-item .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.reply-num { color: #9fb0ac; font-size: 12px; }

/* ---------- 表单 ---------- */
.compose {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fbfdfc;
}
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 90px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
  outline: none;
}
input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text); font-weight: 500; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(16,24,28,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  backdrop-filter: blur(3px);
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
.modal-wide { max-width: 560px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}
.modal-card h2 { margin: 0; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- 后台管理 ---------- */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { border-radius: 8px; }
.tab.active { color: var(--accent-strong); font-weight: 600; border-color: var(--accent); background: var(--accent-soft); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: #f8fbfa; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 13px; background: #f6f9f8; }
.admin-table select { padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); }

/* ---------- 附件 ---------- */
.file-label { gap: 6px; cursor: pointer; }
.file-label input { cursor: pointer; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px;
  font-size: 13px; background: #f7faf9;
}
.file-item button { padding: 3px 10px; font-size: 12px; color: var(--danger); }
.attachments { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.attachment { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--surface); }
.attachment img, .attachment video { display: block; max-width: 100%; max-height: 420px; border-radius: 6px; background: #111; }
.attachment-meta { color: var(--muted); font-size: 12px; margin-top: 7px; overflow-wrap: anywhere; }
.attachment-file a { color: var(--accent-strong); font-weight: 600; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #263238;
  color: #fff;
  border-radius: 10px;
  padding: 11px 18px;
  z-index: 100;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 90vw;
}
.toast:not(.hidden) { opacity: 1; transform: translateX(-50%) translateY(0); }
.global-error {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #fff1f0; color: var(--danger); border: 1px solid #e5b4af;
  border-radius: 10px; padding: 11px 18px; z-index: 120;
  max-width: 90vw; box-shadow: var(--shadow-md); font-size: 14px;
}
.hidden { display: none !important; }
.tip { color: var(--muted); font-size: 14px; }

/* ---------- 验证码 ---------- */
.captcha-box { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; line-height: 0; background: #fff; }
.captcha-box svg { display: block; width: 120px; height: 44px; }
.captcha-row { display: flex; gap: 8px; }
.captcha-row input { flex: 1; }
.captcha-row button { flex-shrink: 0; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 28px;
  text-align: center;
  color: #93a5a1;
  font-size: 12.5px;
  padding-bottom: 8px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .userbox { width: 100%; justify-content: flex-end; }
  .view { padding: 16px; }
  .thread-row { grid-template-columns: auto 1fr; grid-template-areas: "avatar title" "avatar meta" "excerpt excerpt" "time time"; }
  .thread-time { grid-area: time; margin-top: 4px; }
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
  .modal-card { padding: 22px 20px; }
}

/* ---------- 附件缩略图 ---------- */
.file-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.file-item { display: flex; align-items: center; gap: 10px; }
.file-item span { flex: 1; overflow-wrap: anywhere; }

/* ---------- 上传中按钮 ---------- */
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 最小列表 ---------- */
.thread-list { display: flex; flex-direction: column; gap: 0; }
.thread-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
}
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: var(--accent-soft); box-shadow: none; transform: none; }
.t-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.t-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.t-replies { color: var(--accent-strong); font-weight: 600; }
.t-author { color: var(--muted); }
.t-time { color: #9aaca8; }

@media (max-width: 640px) {
  .t-time { display: none; }
}

/* ---------- 表格样式列表 ---------- */
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.list-table thead th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border-strong);
}
.list-table tbody td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.list-table tbody tr:last-child td { border-bottom: 0; }
.list-table tbody tr { cursor: pointer; transition: background .12s ease; }
.list-table tbody tr:hover { background: var(--accent-soft); }
.lt-title { width: auto; }
.lt-title-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text);
}
.lt-replies { width: 64px; color: var(--accent-strong); font-weight: 600; }
.lt-author { width: 110px; color: var(--muted); }
.lt-time { width: 140px; color: #9aaca8; font-size: 12.5px; white-space: nowrap; }

@media (max-width: 640px) {
  .lt-time { display: none; }
  .lt-author { width: 80px; }
}

/* ---------- 帖子列表（清爽版 v3） ---------- */
.thread-list { display: flex; flex-direction: column; gap: 2px; }
.thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .15s ease;
}
.thread-row:hover { background: #eef6f5; box-shadow: none; transform: none; }
.thread-row .avatar { width: 38px; height: 38px; font-size: 14px; flex-shrink: 0; }
.t-main { flex: 1; min-width: 0; }
.t-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-replies {
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
  padding: 3px 12px;
  border-radius: 20px;
  background: #e9eeed;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- 帖子列表（极简紧凑 v4） ---------- */
.thread-list { display: flex; flex-direction: column; gap: 4px; }
.thread-row {
  display: block;
  padding: 9px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
}
.thread-row:hover { background: #eef6f5; }
.t-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 帖子列表（标题+元信息同行 v5） ---------- */
.thread-list { display: flex; flex-direction: column; gap: 4px; }
.thread-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
}
.thread-row:hover { background: #eef6f5; }
.t-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.t-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 0;
}

@media (max-width: 480px) {
  .t-meta { display: none; }
}

/* ---------- 帖子列表（有边框 v6） ---------- */
.thread-row {
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.thread-row:first-child { border-top: 1px solid var(--border); }
.thread-row:last-child { border-bottom: 0; }
