:root{--blue:#1677ff;--ink:#1f2937;--muted:#6b7280;--line:#e5e7eb;--bg:#f3f5f7}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}.wrap{width:min(1180px,calc(100% - 32px));margin:auto}.site-header{background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}.site-header .wrap{height:64px;display:flex;align-items:center;gap:24px}.brand{font-size:22px;font-weight:700;color:var(--blue);text-decoration:none}.search{margin-left:auto;display:flex;border:1px solid var(--line);border-radius:8px;overflow:hidden}.search input{border:0;padding:8px 12px;width:230px}.search button{border:0;background:transparent;padding:0 12px;font-size:20px}.admin-link{color:var(--muted);text-decoration:none}.page{padding:28px 0 56px}.toolbar,.composer,.thread-card,.post-card,.empty{background:#fff;border:1px solid var(--line);border-radius:8px}.toolbar{margin-top:16px;padding:12px 14px;display:flex;align-items:center;gap:16px}.forum-toolbar{justify-content:space-between}.tabs{display:flex;align-items:center;gap:18px;min-width:0;overflow:auto}.tabs a{color:var(--muted);text-decoration:none;white-space:nowrap}.tabs a.active{color:var(--blue);font-weight:600}.btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--line);background:#fff;border-radius:6px;padding:9px 16px;color:var(--ink);text-decoration:none;cursor:pointer;white-space:nowrap}.btn-primary{background:var(--blue);border-color:var(--blue);color:#fff}.list-head{display:flex;justify-content:space-between;align-items:center;margin-top:14px;color:var(--muted);font-size:13px}.thread-list{display:grid;gap:8px;margin-top:8px}.thread-columns,.thread-card{display:grid;grid-template-columns:92px minmax(220px,1fr) 150px 70px 70px 150px 150px;align-items:center;gap:12px}.thread-columns{padding:0 18px;color:var(--muted);font-size:12px}.thread-card{padding:13px 18px}.thread-title{font-size:15px;font-weight:600;color:var(--ink);text-decoration:none;overflow-wrap:anywhere}.thread-title:hover{color:var(--blue)}.thread-author{font-size:13px;overflow-wrap:anywhere}.thread-time,.thread-number{color:var(--muted);font-size:12px}.thread-number{text-align:center}.tag{display:inline-block;background:#eef5ff;color:#1769d2;border-radius:4px;padding:1px 7px;margin:0 5px 4px 0;font-size:12px}.pagination{display:flex;justify-content:flex-end;gap:5px;margin:18px 0}.pagination a{padding:5px 10px;border:1px solid var(--line);border-radius:5px;background:#fff;color:var(--ink);text-decoration:none}.pagination a.current{background:var(--blue);border-color:var(--blue);color:#fff}.composer{margin-top:18px;padding:22px}.field{margin-bottom:14px}.field label{display:block;font-weight:600;margin-bottom:6px}.field input,.field textarea{width:100%;border:1px solid var(--line);border-radius:6px;padding:10px 12px;font:inherit}.field textarea{min-height:230px}.editor-tools{display:flex;gap:6px;padding:8px;background:#f8fafc;border:1px solid var(--line);border-bottom:0}.editor-tools button{border:1px solid var(--line);background:#fff;border-radius:4px;padding:4px 9px}.post-card{margin-top:14px;padding:20px}.post-head{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:12px}.post-body{padding:18px 0;overflow-wrap:anywhere;font-size:16px}.post-body img{max-width:100%;height:auto}.muted,.post-foot{color:var(--muted)}.site-footer{color:var(--muted);padding:20px 0;background:#fff}.footer-stats{display:flex;justify-content:space-between;gap:16px;font-size:12px}.footer-stats strong{color:var(--ink)}.empty{text-align:center;padding:60px 20px;color:var(--muted)}@media(max-width:900px){.thread-columns,.thread-card{grid-template-columns:80px minmax(180px,1fr) 120px 55px 55px 125px 125px;gap:8px}}@media(max-width:700px){.wrap{width:calc(100% - 20px)}.footer-stats{align-items:flex-start;flex-direction:column;gap:4px}.site-header .wrap{height:56px}.brand{font-size:18px}.search{display:none}.admin-link{margin-left:auto}.page{padding:14px 0 34px}.toolbar{padding:10px 12px}.thread-columns{display:none}.thread-card{display:grid;grid-template-columns:1fr auto;gap:5px 10px;padding:14px}.thread-tags,.thread-title{grid-column:1/-1}.thread-author,.thread-time{grid-column:1}.thread-number{grid-column:2;text-align:right}.composer,.post-card{padding:15px}.btn{padding:8px 12px}}

/* Mobile topic cards: keep labels and values readable on narrow screens. */
@media(max-width:700px){.thread-list{width:100%;overflow:hidden}.thread-card{width:100%;min-width:0;grid-template-columns:minmax(0,1fr) auto;overflow:hidden}.thread-title{display:block;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.55}.thread-author{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#374151}.thread-number{grid-column:auto;text-align:left;white-space:nowrap;font-size:12px}.thread-number:nth-of-type(1)::before{content:'浏览 ';color:#667085}.thread-number:nth-of-type(2)::before{content:'回复 ';color:#667085}.thread-time{grid-column:1/-1;width:100%;font-size:12px;white-space:normal}.thread-time:nth-of-type(1)::before{content:'发布：';color:#667085}.thread-time:nth-of-type(2)::before{content:'最后回复：';color:#667085}.thread-tags{min-height:20px;overflow:hidden}.badge,.tag{white-space:nowrap}}
@media(max-width:700px){.thread-card{padding:10px 12px;gap:3px 8px;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:auto auto auto auto auto}.thread-title{font-size:15px;font-weight:650}.thread-author{font-size:12px;grid-column:1;grid-row:3}.thread-number{font-size:11px;grid-row:4;text-align:left}.thread-card>.thread-number:first-of-type{grid-column:2}.thread-card>.thread-number+.thread-number{grid-column:3}.thread-number::before{content:none!important}.thread-time{font-size:11px;color:#6b7280;grid-column:1/-1;grid-row:5}.thread-card>.thread-time+.thread-time{grid-row:6}.thread-time::before{content:none!important}.post-card{margin-top:10px;padding:13px}.post-head{padding-bottom:8px;font-size:12px}.post-body{padding:12px 0;font-size:15px;line-height:1.7}.post-body p{margin:6px 0}.quick-reply{margin-top:12px}.quick-heading{display:flex;justify-content:space-between;align-items:center}.quick-heading h2{font-size:17px;margin:0}}

/* Compact desktop topic rows. */
@media (min-width: 701px) { .list-head { margin-top: 12px; } .thread-list { gap: 2px; margin-top: 6px; } .thread-columns { padding-left: 14px; padding-right: 14px; } .thread-card { min-height: 50px; padding: 8px 14px; border-radius: 4px; } }
@media(max-width:700px){.thread-card>.thread-tags{grid-column:1/-1;grid-row:1}.thread-card>.thread-title{grid-column:1/-1;grid-row:2}.thread-card>.thread-author{grid-column:1;grid-row:3}.thread-card>.thread-number{grid-row:4}.thread-card>.thread-number:first-of-type{grid-column:1}.thread-card>.thread-number+.thread-number{grid-column:2}.thread-card>.thread-time{grid-column:1/-1;grid-row:5}.thread-card>.thread-time+.thread-time{grid-row:6}}

/* Final thread-card layout: direct child positions are stable and do not depend on :first-of-type. */
.thread-card > .thread-number,
.thread-card > .thread-time { min-width: 0; }
.thread-card > .thread-number { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.thread-card > .thread-number::before { display: inline-block; color: #98a2b3; font-size: 13px; line-height: 1; }
.thread-card > .thread-number:nth-child(4)::before { content: "\25C9" !important; }
.thread-card > .thread-number:nth-child(5)::before { content: "\25A1" !important; }
.thread-card > .thread-time { white-space: nowrap; }
.thread-media-icon { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-right: 5px; border: 1px solid currentColor; border-radius: 2px; font-size: 12px; line-height: 1; vertical-align: -2px; }
.thread-image-icon { color: #1677ff; }
.thread-attachment-icon { color: #667085; }

@media (max-width: 700px) {
  .thread-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto auto auto auto auto;
    align-items: center;
    gap: 4px 8px;
    padding: 11px 12px;
  }
  .thread-card > .thread-tags { grid-column: 1 / -1; grid-row: 1; }
  .thread-card > .thread-title { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .thread-media-icon { width: 16px; height: 16px; margin-right: 4px; font-size: 11px; }
  .thread-card > .thread-author { grid-column: 1 / -1; grid-row: 3; min-width: 0; }
  .thread-card > .thread-number { grid-row: 4; justify-content: flex-start; text-align: left; font-size: 12px; }
  .thread-card > .thread-number:nth-child(4) { grid-column: 2; }
  .thread-card > .thread-number:nth-child(5) { grid-column: 3; }
  .thread-card > .thread-time { grid-column: 1 / -1; width: 100%; font-size: 11px; line-height: 1.5; }
  .thread-card > .thread-time:nth-child(6) { grid-row: 5; }
  .thread-card > .thread-time:nth-child(7) { grid-row: 6; }
  .thread-card > .thread-number::before { font-size: 12px; }
  .thread-card > .thread-number:nth-child(4)::after { content: "浏览"; color: #98a2b3; font-size: 11px; order: 3; }
  .thread-card > .thread-number:nth-child(5)::after { content: "回复"; color: #98a2b3; font-size: 11px; order: 3; }
  .thread-card > .thread-time::before { content: none !important; }
}

/* The topic list keeps only the activity time. A topic with no replies uses
   its original post time, so the column remains useful without duplication. */
.thread-posted-at { display: none !important; }
@media (min-width: 701px) {
  .thread-columns, .thread-card {
    grid-template-columns: 92px minmax(220px, 1fr) 150px 70px 70px 150px;
  }
}
@media (max-width: 700px) {
  .thread-card > .thread-last-reply-at { grid-row: 5; }
}

/* Stable thread card layout. Keep the semantic order in the markup instead of
   relying on nth-child selectors, which break when badges are added. */
.thread-card > .thread-stat,
.thread-card > .thread-time { min-width: 0; }
.thread-card > .thread-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.thread-stat-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  background: center / contain no-repeat;
  opacity: .8;
}
.thread-views .thread-stat-icon {
  background-image: url('/public/assets/icons/thread-view.svg');
}
.thread-replies .thread-stat-icon {
  background-image: url('/public/assets/icons/thread-reply.svg');
}
.thread-stat-value { order: 2; }
.thread-card > .thread-time {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-media-icon {
  width: 16px;
  height: 16px;
  margin-right: 5px;
  border: 0;
  border-radius: 0;
  background: center / contain no-repeat;
  font-size: 0;
  vertical-align: -3px;
}
.thread-image-icon {
  color: #1677ff;
  background-image: url('/public/assets/icons/thread-image.svg');
}
.thread-attachment-icon {
  color: #667085;
  background-image: url('/public/assets/icons/thread-attachment.svg');
}

/* Tripcode avatars: compact in topic rows, larger and stable in posts. */
.author-with-avatar { display:inline-flex; align-items:center; gap:7px; min-width:0; }
.author-with-avatar > strong, .author-with-avatar > span:last-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.community-avatar { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; overflow:hidden; border-radius:50%; background:linear-gradient(135deg,#e8f1ff,#d9e6ff); color:#1769d2; font-weight:700; border:1px solid #c7d8f4; }
.avatar-small { width:26px; height:26px; font-size:12px; }
.avatar-large { width:44px; height:44px; font-size:18px; }
.community-avatar img { display:block; width:100%; height:100%; object-fit:cover; }
.avatar-page { max-width:720px; margin:0 auto; }
.avatar-page-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:14px; }
.avatar-page-head h1 { margin:0 0 4px; font-size:24px; }
.avatar-page-head p { margin:0; }
.avatar-panel { background:#fff; border:1px solid var(--line); border-radius:8px; padding:22px; }
.avatar-preview-row { display:flex; align-items:center; gap:12px; margin:4px 0 18px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#f8fafc; }
.avatar-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.btn-danger { color:#b42318; border-color:#f0b3ad; background:#fff7f6; }
.alert-error { border-color:#f2b8b5; background:#fff5f4; color:#b42318; }
.alert-success { border-color:#a7dfc0; background:#f0fdf4; color:#167347; }
.alert { margin:14px 0; padding:14px 16px; border:1px solid #f0b4ad; border-left:4px solid #c62828; border-radius:7px; background:#fff5f4; color:#7f1d1d; white-space:pre-line; overflow-wrap:anywhere; }
@media(max-width:700px){
  .avatar-page-head { align-items:flex-start; flex-direction:column; }
  .avatar-page-head h1 { font-size:20px; }
  .avatar-panel { padding:15px; }
  .avatar-large { width:38px; height:38px; font-size:16px; }
  .thread-card > .thread-author { display:flex; }
  .thread-card > .thread-author .avatar-small { width:22px; height:22px; font-size:11px; }
}

@media (max-width: 700px) {
  .thread-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto auto auto auto auto;
    align-items: center;
    gap: 4px 8px;
    padding: 11px 12px;
  }
  .thread-card > .thread-tags { grid-column: 1 / -1; grid-row: 1; }
  .thread-card > .thread-title { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .thread-card > .thread-author { grid-column: 1 / -1; grid-row: 3; min-width: 0; }
  .thread-card > .thread-views { grid-column: 2; grid-row: 4; justify-content: flex-start; }
  .thread-card > .thread-replies { grid-column: 3; grid-row: 4; justify-content: flex-start; }
  .thread-card > .thread-posted-at { display: none !important; }
  .thread-card > .thread-last-reply-at { grid-column: 1 / -1; grid-row: 5; }
  .thread-card > .thread-time::before { content: none !important; }
  .thread-card > .thread-stat { font-size: 11px; }
  .thread-stat-icon { width: 14px; height: 14px; flex-basis: 14px; }
  .thread-media-icon { width: 15px; height: 15px; margin-right: 4px; }
}

/* Topic titles should be prominent without overwhelming the post content. */
.post-card > h1 {
  margin: 14px 0 8px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 650;
}
@media (max-width: 700px) {
  .post-card > h1 {
    margin: 10px 0 6px;
    font-size: 20px;
    line-height: 1.4;
  }
}
