:root {
  --bg: #dae0e6;
  --card: #fff;
  --border: #ccc;
  --text: #1c1c1c;
  --muted: #787c7e;
  --accent: #ff4500;
  --blue: #0079d3;
  --down: #7193ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: inherit; }
h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 20px; }
h3 { font-size: 15px; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.error { color: #d93a00; background: #fff4f0; padding: 8px 12px; border-radius: 4px; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid #edeff1; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.logo { font-size: 18px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
nav { display: flex; align-items: center; gap: 14px; }
nav a { color: var(--text); font-weight: 500; }

/* 按钮 */
.btn {
  display: inline-block; background: var(--blue); color: #fff !important; border: 1px solid var(--blue);
  border-radius: 999px; padding: 4px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
  text-align: center;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.outline { background: transparent; color: var(--blue) !important; }
.btn.block { display: block; margin-top: 8px; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; }
button.link:hover { text-decoration: underline; }
button.link.danger:hover { color: #d93a00; }
form.inline { display: inline; }

/* 布局 */
main { padding: 20px 16px; }
.layout { display: grid; grid-template-columns: 1fr 310px; gap: 24px; align-items: start; }
.layout.single { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } aside { order: -1; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: 12px 16px; margin-bottom: 12px; }
.section-title { font-size: 14px; color: var(--muted); text-transform: uppercase; margin: 16px 0 8px; }
.section-title:first-child { margin-top: 0; }

.sortbar { display: flex; gap: 8px; padding: 8px 12px; }
.sortbar a { color: var(--muted); font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.sortbar a.on { background: #f6f7f8; color: var(--blue); }
.sortbar a:hover { text-decoration: none; background: #f6f7f8; }

.community-head { border-top: 4px solid var(--blue); }
.community-row { padding: 10px 0; border-bottom: 1px solid #edeff1; }
.community-row:last-child { border-bottom: 0; }
.community-row p { margin: 4px 0 0; }
.clist { margin: 0; padding-left: 20px; }
.clist li { padding: 4px 0; }

/* 帖子 */
.post { display: flex; padding: 0; overflow: hidden; }
.post:not(.full):hover { border-color: #898989; }
.post > .vote { flex-direction: column; background: #f8f9fa; padding: 8px 4px; width: 44px; }
.post-main { padding: 8px 12px; flex: 1; min-width: 0; }
.post .meta, .comment .meta, .user-comment .meta { font-size: 12px; color: var(--muted); }
.meta a { color: var(--muted); }
.meta a.sub, a.sub { color: var(--text); font-weight: 700; }
.post .title { font-size: 18px; font-weight: 500; margin: 4px 0; word-break: break-word; }
.post .title a { color: var(--text); }
.post.full .title { font-size: 22px; }
.domain { font-size: 12px; color: var(--blue); font-weight: 400; }
.ext { word-break: break-all; }
.body { white-space: pre-wrap; word-break: break-word; margin: 8px 0; }
.actions { display: flex; gap: 16px; font-size: 12px; font-weight: 700; color: var(--muted); }
.actions a { color: var(--muted); }

/* 投票 */
.vote { display: flex; align-items: center; gap: 4px; }
.vote button {
  background: none; border: 0; cursor: pointer; color: #878a8c; font-size: 14px;
  padding: 2px 4px; border-radius: 2px; line-height: 1;
}
.vote button:hover { background: #e8e8e8; }
.vote button.up.on, .vote button.up:hover { color: var(--accent); }
.vote button.down.on, .vote button.down:hover { color: var(--down); }
.vote .score { font-weight: 700; font-size: 12px; min-width: 20px; text-align: center; }
.vote .score.up { color: var(--accent); }
.vote .score.down { color: var(--down); }

/* 评论 */
.comment-form { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-bottom: 16px; }
.comments { margin-top: 8px; }
.comment { margin-top: 12px; }
.comment .body { margin: 4px 0; }
.comment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 12px; font-weight: 700; }
.reply summary { color: var(--muted); cursor: pointer; list-style: none; }
.reply summary::-webkit-details-marker { display: none; }
.reply[open] { flex-basis: 100%; order: 10; }
.reply[open] summary { margin-bottom: 6px; }
.children { margin-left: 10px; padding-left: 14px; border-left: 2px solid #edeff1; }
.children:hover { border-left-color: #c8cbcd; }

/* 表单 */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
input, textarea, select {
  width: 100%; font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid #edeff1;
  border-radius: 4px; background: #f6f7f8;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); background: #fff; }
textarea { resize: vertical; }
.prefix { display: flex; align-items: center; }
.prefix span { padding: 0 6px; color: var(--muted); }
.stack .btn { align-self: flex-start; padding: 6px 24px; }

.auth { max-width: 380px; margin: 40px auto; padding: 24px; }
