:root {
  --bg: #f6f1ea;
  --card: #fffdf9;
  --ink: #3b3330;
  --soft: #8a7f78;
  --line: #ebe2d8;
  --accent: #c9776b;
  --accent-soft: #f6e4df;
  --u1: #c9776b;
  --u2: #6b8fc9;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.sub { margin: 0; color: var(--soft); font-size: 14px; }
small { color: var(--soft); font-weight: 400; font-size: 13px; }
.muted { color: var(--soft); }

button {
  font: inherit; border: 0; cursor: pointer;
  background: var(--accent); color: #fff;
  padding: 8px 18px; border-radius: 999px;
  transition: opacity .15s; white-space: nowrap;
}
button:hover { opacity: .85; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--soft); border: 1px solid var(--line); }
button.link { background: none; color: var(--soft); padding: 0; font-size: 13px; }
button.link:hover { color: var(--accent); opacity: 1; }
button.link.danger:hover { color: #b5483b; }
input, textarea {
  font: inherit; color: inherit; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

/* 登录 / Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--card); padding: 40px 32px; border-radius: 20px; width: 100%; max-width: 360px;
  text-align: center; box-shadow: 0 10px 40px rgba(80, 50, 30, .08);
}
.lock { font-size: 36px; margin-bottom: 8px; }
.login-card form { margin-top: 24px; display: grid; gap: 12px; }
.error { color: #b5483b; font-size: 14px; min-height: 1.4em; margin: 0; }

/* 布局 / Layout */
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 80px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.layout { display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start; }
.layout.solo { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side-col { order: -1; }
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
.side-col .card { position: sticky; top: 16px; }
.empty { text-align: center; color: var(--soft); white-space: pre-line; padding: 36px 20px; }

/* 头像 / Avatars */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: #fff; font-size: 16px; flex-shrink: 0; background: #bbb;
}
.avatar.xs { width: 24px; height: 24px; font-size: 12px; }
.avatar.u1, .dot.u1.on { background: var(--u1); }
.avatar.u2, .dot.u2.on { background: var(--u2); }

/* 帖子列表 / Thread list */
.list-card { padding: 0; overflow: hidden; }
.list-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.thread-row {
  display: flex; justify-content: space-between; gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--line); transition: background .15s;
}
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: #fbf6f0; }
.thread-row.is-today { background: var(--accent-soft); }
.thread-row.is-notice { background: #fbf3e4; }
.notice-tag {
  display: inline-block; font-size: 12px; font-weight: 600; color: #fff; background: #c99a4b;
  padding: 0 8px; border-radius: 6px; line-height: 20px;
}
.bgm-card { display: grid; gap: 8px; }
.bgm-head { display: flex; align-items: center; gap: 14px; }
.bgm-title { font-weight: 600; margin-right: auto; }
.bgm-note { color: var(--soft); font-size: 14px; white-space: pre-wrap; }
.bgm-player { width: 100%; max-width: 420px; border: 0; display: block; }
.bgm-link { font-size: 13px; color: var(--soft); }
.bgm-link:hover { color: var(--accent); }
.bgm-empty, .bgm-help { color: var(--soft); font-size: 14px; }
.bgm-dot { font-size: 14px; }
.edit-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.floor-main textarea { margin-top: 8px; }
.thread-left { min-width: 0; flex: 1; }
.thread-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.today-tag {
  display: inline-block; font-size: 12px; font-weight: 600; color: #fff; background: var(--accent);
  padding: 0 8px; border-radius: 6px; line-height: 20px;
}
.thread-preview {
  font-size: 14px; color: var(--soft); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-preview b { font-weight: 500; color: var(--ink); }
.thread-right { text-align: right; flex-shrink: 0; font-size: 13px; color: var(--soft); }
.thread-avatars { display: flex; gap: 2px; justify-content: flex-end; min-height: 24px; }
.thread-count { margin-top: 2px; }

/* 帖子详情 / Thread page */
.back { display: inline-block; color: var(--soft); font-size: 14px; margin-bottom: 10px; }
.back:hover { color: var(--accent); }
.thread-title-card h2 { font-size: 22px; }
.thread-title-card .today-tag { margin-bottom: 6px; }

.floor { display: flex; gap: 16px; padding: 16px 18px; transition: box-shadow .3s; }
.floor.flash { box-shadow: 0 0 0 3px var(--accent-soft); }
.floor-user { width: 64px; flex-shrink: 0; text-align: center; }
.floor-name { font-size: 13px; font-weight: 600; margin-top: 4px; word-break: break-all; }
.floor-main { flex: 1; min-width: 0; }
.floor-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); }
.floor-n { font-weight: 600; color: var(--accent); }
.floor-body { margin-top: 6px; white-space: pre-wrap; word-break: break-word; font-size: 16px; }
.floor-deleted { margin-top: 6px; color: var(--soft); font-style: italic; font-size: 14px; }
.floor-foot { display: flex; gap: 16px; justify-content: flex-end; margin-top: 10px; }
.quote {
  display: block; margin-top: 8px; padding: 6px 10px; background: #f4ede5; border-radius: 8px;
  font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quote b { font-weight: 500; color: var(--ink); }
.sticker-big { display: block; max-width: 160px; max-height: 160px; margin-top: 8px; border-radius: 8px; }
.img-grid { display: grid; gap: 6px; margin-top: 10px; }
.img-grid.n1 { grid-template-columns: minmax(0, 360px); }
.img-grid.n2 { grid-template-columns: repeat(2, 1fr); max-width: 480px; }
.img-grid.n3 { grid-template-columns: repeat(3, 1fr); max-width: 520px; }
.img-grid img { width: 100%; border-radius: 8px; cursor: zoom-in; display: block; background: #eee6dd; }
.img-grid.n2 img, .img-grid.n3 img { aspect-ratio: 1; object-fit: cover; }
@media (max-width: 560px) {
  .floor { gap: 10px; padding: 14px; }
  .floor-user { width: 44px; }
  .floor-user .avatar { width: 34px; height: 34px; font-size: 14px; }
}

/* 回帖框 / Composer */
.composer { box-shadow: 0 6px 24px rgba(80, 50, 30, .08); display: grid; gap: 10px; }
.reply-to {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--accent-soft); border-radius: 8px; padding: 4px 10px; font-size: 13px;
}
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tools { display: flex; gap: 6px; }
.tool {
  background: #f4ede5; color: var(--ink); padding: 4px 12px; border-radius: 999px;
  font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.tool:hover { background: var(--accent-soft); opacity: 1; }
.send { display: flex; align-items: center; gap: 10px; }
.hint { color: var(--soft); font-size: 12px; }
.attach-preview { display: flex; gap: 8px; flex-wrap: wrap; }
.attach-preview:empty { display: none; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: #eee6dd; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.loading { display: grid; place-items: center; font-size: 12px; color: var(--soft); }
.thumb-x {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; background: rgba(0, 0, 0, .55); font-size: 14px; line-height: 22px;
}
.panel {
  border-top: 1px solid var(--line); padding-top: 10px; max-height: 240px; overflow-y: auto;
}
#emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.emoji { background: none; padding: 4px; font-size: 22px; border-radius: 8px; color: inherit; }
.emoji:hover { background: #f4ede5; opacity: 1; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.sticker {
  aspect-ratio: 1; background: #f8f3ed; border-radius: 10px; padding: 6px;
  display: grid; place-items: center; cursor: pointer;
}
.sticker img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sticker:hover { background: var(--accent-soft); opacity: 1; }
.sticker.add {
  border: 1.5px dashed var(--line); color: var(--soft); font-size: 12px; text-align: center;
  white-space: pre-line; line-height: 1.4;
}
.panel-note { font-size: 11px; color: var(--soft); margin: 8px 0 0; }

/* 看大图 / Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(20, 15, 12, .88); display: grid; place-items: center;
  z-index: 50; cursor: zoom-out; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 60;
  background: rgba(40, 30, 25, .9); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 14px;
}

/* 来访记录 / Activity */
.note { color: var(--soft); font-size: 12px; margin: 2px 0 14px; }
.act-user { padding: 12px 0; border-top: 1px solid var(--line); }
.act-user:first-child { border-top: 0; padding-top: 0; }
.act-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.today-badge {
  margin-left: auto; font-size: 12px; font-weight: 400; padding: 1px 8px; border-radius: 999px;
  background: #eee6dd; color: var(--soft); white-space: nowrap;
}
.today-badge.yes { background: #dcefdc; color: #3d7a3d; }
details.act-fold > summary { cursor: pointer; list-style: none; }
details.act-fold > summary::-webkit-details-marker { display: none; }
.fold-hint { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--soft); }
.fold-hint::after { content: ' ▸'; }
details.act-fold[open] .fold-hint { font-size: 0; }
details.act-fold[open] .fold-hint::after { content: '收起 ▾'; font-size: 12px; }
.fold-body { margin-top: 6px; }
.fold-body .today-badge { margin-left: 0; }
.act-line { font-size: 13px; color: var(--soft); margin-top: 4px; }
.dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.dot { aspect-ratio: 1; border-radius: 4px; background: #eee6dd; }
.dot.today { outline: 1.5px solid var(--ink); outline-offset: 1px; }
.dots-caption { font-size: 11px; color: var(--soft); margin-top: 4px; display: flex; justify-content: space-between; }
details.logins { margin-top: 8px; font-size: 13px; color: var(--soft); }
details.logins summary { cursor: pointer; }
details.logins ul { margin: 4px 0 0; padding-left: 18px; }
