/* ====== 东京硅谷茶水间 · 样式 ====== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #1f2328;
  --text-2: #57606a;
  --text-3: #8b949e;
  --accent: #0d6b5c;
  --accent-hover: #0a564a;
  --accent-soft: #e6f3f0;
  --me: #b45309;
  --me-soft: #fdf3e2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 6px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1f232b;
    --border: #2a2f38;
    --text: #e6e8eb;
    --text-2: #a3aab5;
    --text-3: #6f7681;
    --accent: #3fb59c;
    --accent-hover: #5cc7b0;
    --accent-soft: #163229;
    --me: #f0a447;
    --me-soft: #3a2a12;
    --danger: #ff6b5e;
    --danger-soft: #3a1c19;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
main.container { flex: 1; padding-top: 24px; padding-bottom: 48px; }

/* ---- header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 26px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand-tagline { font-size: 12px; color: var(--text-3); }
.header-nav { display: flex; align-items: center; gap: 12px; }
.mode-badge { font-size: 12px; color: var(--text-3); }
.mode-badge.local { background: var(--me-soft); color: var(--me); padding: 2px 8px; border-radius: 999px; cursor: help; }

/* ---- buttons ---- */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.board-item {
  display: flex; flex-direction: column;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
}
.board-item:hover { background: var(--surface); text-decoration: none; }
.board-item.active { background: var(--accent-soft); color: var(--accent); }
.board-name { font-weight: 600; font-size: 14px; }
.board-desc { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.board-item.active .board-desc { color: var(--accent); opacity: .8; }
.sidebar-note { margin-top: 16px; padding: 12px; font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--border); }
.sidebar-note p { margin: 6px 0 0; }

.main { min-width: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- list ---- */
.list-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; margin: 0; font-weight: 700; }
.page-desc { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 8px; }
.tab { padding: 4px 12px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.post-list { overflow: hidden; }
.post-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.post-row:last-child { border-bottom: none; }
.post-row:hover { background: var(--surface-2); }
.post-main { flex: 1; min-width: 0; }
.post-title { color: var(--text); font-weight: 600; font-size: 15.5px; display: block; }
.post-title:hover { color: var(--accent); text-decoration: none; }
.post-meta { margin-top: 4px; font-size: 12.5px; color: var(--text-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dot { color: var(--border); }
.tag { font-size: 11.5px; background: var(--surface-2); color: var(--text-2); padding: 1px 8px; border-radius: 999px; }
.tag:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent); }
.author { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.author.me { color: var(--me); background: var(--me-soft); padding: 0 6px; border-radius: 4px; }
.author em { font-style: normal; font-family: var(--font); font-size: 11px; margin-left: 4px; color: var(--accent); background: var(--accent-soft); padding: 0 5px; border-radius: 4px; }
.reply-count {
  flex-shrink: 0;
  min-width: 36px; text-align: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.reply-count.zero { background: var(--surface-2); color: var(--text-3); }
.reply-count:hover { text-decoration: none; }
.list-footer { margin-top: 16px; text-align: right; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty.small { padding: 24px; }

/* ---- thread ---- */
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }
.thread { padding: 24px 28px; }
.thread-title { font-size: 22px; margin: 0 0 10px; line-height: 1.35; font-weight: 700; }
.thread-body { margin-top: 18px; }
.body { font-size: 15.5px; line-height: 1.8; word-break: break-word; overflow-wrap: anywhere; }
.body p { margin: 0 0 1em; }
.body p:last-child { margin-bottom: 0; }

.replies { margin-top: 28px; }
.section-title { font-size: 15px; color: var(--text-2); margin: 0 0 10px; font-weight: 600; }
.reply {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
}
.reply:target { border-color: var(--accent); }
.reply-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; }
.floor { font-family: var(--mono); color: var(--text-3); }
.reply .body { font-size: 15px; }

/* ---- forms ---- */
.reply-form, .new-form { padding: 20px 24px; margin-top: 20px; }
.reply-form h3 { margin: 0 0 10px; font-size: 15px; }
.new-form .page-title { margin-bottom: 4px; }
.new-form .page-desc { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
input[type=text], textarea, select {
  display: block; width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit; font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.form-row .btn + .btn { margin-left: 8px; }
.counter { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 8px; font-size: 14px; margin: 10px 0 0; }
.error-card { padding: 24px; border-color: var(--danger); }

.loading { padding: 48px; text-align: center; color: var(--text-3); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 28px; font-size: 12.5px; color: var(--text-3); }
.site-footer p { margin: 4px 0; }

/* ---- search ---- */
.search-form input {
  width: 200px; margin: 0; padding: 6px 12px; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 999px;
}
.search-form input:focus { background: var(--bg); border-color: var(--border); outline: none; }

/* ---- small buttons / link buttons ---- */
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.link-btn { background: none; border: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--text-3); cursor: pointer; }
.link-btn:hover { color: var(--danger); text-decoration: underline; }
.spacer { flex: 1; }
.row-left { display: flex; align-items: center; gap: 12px; }
.pin { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0 6px; border-radius: 4px; margin-right: 6px; vertical-align: 2px; }

/* ---- 置顶区：独立于排序，永远在列表最上方 ---- */
.pinned-block { margin-bottom: 14px; overflow: hidden; border-color: var(--accent); }
.pinned-head {
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  color: var(--accent); background: var(--accent-soft);
  padding: 6px 18px; border-bottom: 1px solid var(--border);
}
.pinned-block .post-row { background: transparent; }
.pinned-block .post-row:hover { background: var(--surface-2); }

/* ---- 站长专有的行内操作 ---- */
.admin-inline { color: var(--accent); font-weight: 600; }
.admin-inline:hover { color: var(--accent-hover); }
.admin-inline.danger { color: var(--danger); }
.admin-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding: 8px 12px;
  font-size: 12.5px; color: var(--text-3);
  background: var(--surface-2); border-radius: 8px;
}
.body-img { display: block; max-width: 100%; max-height: 520px; border-radius: 8px; margin: 6px 0; border: 1px solid var(--border); }
.turnstile-slot { margin-top: 10px; min-height: 0; }
.turnstile-slot:empty { display: none; }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { width: 100%; max-width: 460px; padding: 20px 24px; }
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal .muted { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.muted { color: var(--text-3); }

/* ---- admin ---- */
.admin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-tabs { display: inline-flex; margin-bottom: 12px; }
.admin-body { padding: 0; overflow-x: auto; }
.admin-row { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: none; }
.admin-row-head { display: flex; gap: 10px; align-items: center; font-size: 12.5px; margin-bottom: 6px; }
.admin-reason { font-size: 15px; margin-bottom: 8px; }
.admin-target { font-size: 13.5px; }
.admin-excerpt { color: var(--text-2); font-size: 13px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.admin-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); vertical-align: 1px; }
.badge.del { background: var(--danger-soft); color: var(--danger); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { font-size: 12px; color: var(--text-3); font-weight: 600; background: var(--surface-2); }
.admin-table tr.deleted td { opacity: .55; }
.admin-table td.admin-actions { display: table-cell; white-space: nowrap; }
.admin-table td.admin-actions .btn + .btn { margin-left: 6px; }
.admin-login { max-width: 420px; margin: 40px auto 0; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .board-item { padding: 6px 10px; }
  .board-desc { display: none; }
  .sidebar-note { display: none; }
  .brand-tagline { display: none; }
  .search-form input { width: 120px; }
  .thread { padding: 18px; }
  .thread-title { font-size: 19px; }
  .post-row { padding: 12px 14px; }
  .list-header { align-items: flex-start; }
}
