* { box-sizing: border-box; }
:root {
  --bg: #f4f1ec;
  --card: #fffdf9;
  --ink: #2b2a28;
  --muted: #8a857c;
  --line: #e6e0d6;
  --accent: #c8553d;
  --accent-dark: #a8432e;
}
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  transition: background .15s;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .6; cursor: default; }
input, textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,85,61,.12); }
textarea { resize: vertical; }

/* 登录页 */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--card);
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(60,40,20,.08);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; font-size: 26px; letter-spacing: 2px; }
.login-card .sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.login-card button { margin-top: 6px; padding: 11px; font-size: 16px; }
.error { color: var(--accent); font-size: 14px; min-height: 20px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
  background: rgba(244,241,236,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.count { color: var(--muted); font-size: 14px; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 5px 12px; font-size: 14px; }
.ghost:hover { background: #fff; color: var(--ink); }

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }

/* 发表区 */
.composer {
  background: var(--card); border-radius: 14px; padding: 18px;
  box-shadow: 0 2px 12px rgba(60,40,20,.05);
  display: flex; flex-direction: column; gap: 10px;
}
.composer #nickname { max-width: 260px; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; }
.hint { color: var(--muted); font-size: 13px; }

.toolbar { margin: 22px 0 12px; }

/* 留言列表 */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(60,40,20,.05);
  animation: in .25s ease;
}
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.card-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 600; flex-shrink: 0;
}
.meta { display: flex; flex-direction: column; line-height: 1.3; }
.time { color: var(--muted); font-size: 12px; }
.content { margin: 10px 0 6px; white-space: pre-wrap; word-break: break-word; }

.actions { display: flex; gap: 4px; margin-left: -8px; }
.link { background: transparent; color: var(--muted); padding: 4px 8px; font-size: 14px; }
.link:hover { background: #f1ece4; color: var(--ink); }
.link.liked { color: var(--accent); }
.link.danger:hover { color: #c0392b; }
.link.small { font-size: 12px; padding: 0 6px; margin-left: auto; opacity: 0; }
.reply:hover .link.small { opacity: 1; }

.replies { list-style: none; margin: 10px 0 0; padding: 4px 14px; background: #f7f3ed; border-radius: 10px; }
.reply { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.reply:last-child { border-bottom: none; }
.reply-top { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.reply .content { margin: 4px 0 0; font-size: 14px; }

.reply-box { display: flex; gap: 8px; margin-top: 10px; }
.reply-box button { flex-shrink: 0; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: rgba(43,42,40,.9); color: #fff; padding: 8px 18px; border-radius: 20px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .topbar { padding: 10px 14px; }
  .count { display: none; }
  .link.small { opacity: 1; }
}
