:root {
  --brand: #1f5fa8;
  --brand-dark: #174a84;
  --brand-soft: #eaf2fb;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #e2e7ee;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #2f855a;
  --quote: #7a8594;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6ea8ec; --brand-dark: #8dbaf0; --brand-soft: #1d2b3c;
    --bg: #12161c; --panel: #1a2029; --text: #dde3ea; --muted: #8b96a4;
    --line: #2a323d; --quote: #8b96a4; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; }
code { background: var(--brand-soft); padding: 0 4px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { float: right; }
.danger { color: var(--danger) !important; }
.inline { display: inline; margin: 0; }

/* top bar */
.topbar { background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); position: sticky; top: 0; z-index: 10; }
.admin-bar { background: #23303f; }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 52px; flex-wrap: wrap; }
.topbar a, .topbar .linklike { color: #fff; opacity: .92; }
.topbar a:hover, .topbar .linklike:hover { opacity: 1; text-decoration: none; }
.logo { font-weight: 700; font-size: 1.15rem; letter-spacing: .5px; opacity: 1 !important; }
.mainnav, .usernav { display: flex; gap: 14px; align-items: center; }
.mainnav a.active { border-bottom: 2px solid #fff; padding-bottom: 2px; }
.usernav { margin-left: auto; flex-wrap: wrap; }
.usernav .me { font-weight: 600; }
.admin-link { background: rgba(255,255,255,.18); padding: 2px 8px; border-radius: 4px; }
.topbar .quicksearch input { border: 0; border-radius: 16px; padding: 5px 12px; width: 200px; margin: 0; background: rgba(255,255,255,.18); color: #fff; outline: none; }
.topbar .quicksearch input::placeholder { color: rgba(255,255,255,.75); }
.topbar .quicksearch input:focus { background: #fff; color: #222; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px; border-radius: 9px; background: #e53e3e; color: #fff; font-size: .75rem; line-height: 18px; text-align: center; }

main.wrap { padding-top: 18px; padding-bottom: 24px; min-height: 70vh; }
.footer { color: var(--muted); font-size: .85rem; padding: 18px 16px 30px; text-align: center; }

/* layout */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) {
  .grid, .grid.two { grid-template-columns: 1fr; }
  .quicksearch { display: none; }
  .c-mods, .c-board, .c-author .small, .c-last .small { display: none; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-title { font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel-title.pad { padding: 12px 16px 0; }
.panel-title .more { margin-left: auto; font-size: .85rem; font-weight: normal; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }

.flash { background: #e6f4ea; border: 1px solid #b7dfc2; color: #1e5631; padding: 9px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.alert { background: #fdecea; border: 1px solid #f5c2bc; color: #922; padding: 9px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.hint { color: var(--warn); font-size: .9rem; }
.notice { background: #fff8e1; border: 1px solid #f3dd9c; color: #6b5310; padding: 10px 16px; border-radius: var(--radius); margin-bottom: 18px; display: flex; gap: 12px; }
@media (prefers-color-scheme: dark) {
  .flash { background: #1c3326; border-color: #2c5a3c; color: #bfe6cb; }
  .alert { background: #3a1f1f; border-color: #6b2c2c; color: #f3c1c1; }
  .notice { background: #332b14; border-color: #5c4b1c; color: #f0dca0; }
}

/* buttons & forms */
.btn { display: inline-block; background: var(--brand); color: #fff !important; border: 1px solid var(--brand); padding: 6px 16px; border-radius: 6px; font-size: .92rem; cursor: pointer; line-height: 1.5; text-decoration: none !important; }
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: transparent; color: var(--brand) !important; }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 12px; font-size: .85rem; }
.btn.tiny { padding: 1px 9px; font-size: .8rem; }
.btn.block { display: block; width: 100%; text-align: center; }
.topbar .btn.small { background: #fff; color: var(--brand) !important; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.linklike:hover { text-decoration: underline; }
label { display: block; margin-bottom: 12px; font-size: .92rem; }
label.check { display: flex; align-items: center; gap: 6px; }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; font-family: inherit; }
.form-actions { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.auth-panel { max-width: 400px; margin: 30px auto; padding: 24px 28px; }
.form-panel.narrow { max-width: 640px; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-form input, .search-form select { width: auto; flex: 1 1 160px; margin: 0; }
.search-form label.check { margin: 0; }

/* lists */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { font-weight: 600; font-size: .85rem; color: var(--muted); background: var(--bg); }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: var(--brand-soft); }
table.list tr.pinned td { background: rgba(255, 196, 0, .06); }
table.list tr.unread td { font-weight: 600; }
table.list tr.deleted td { opacity: .6; }
.c-num { width: 90px; text-align: center !important; white-space: nowrap; }
.c-last { width: 130px; white-space: nowrap; font-size: .88rem; }
.c-author { width: 120px; }
.c-board { width: 120px; }
.c-mods { width: 150px; font-size: .88rem; }
.c-op { width: 150px; white-space: nowrap; font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 22px !important; }
.board-title { font-weight: 600; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
ul.plain li:last-child { border-bottom: 0; }

.tag { display: inline-block; font-size: .72rem; padding: 0 6px; margin-right: 5px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); vertical-align: 1px; font-weight: normal; }
.tag-pin { background: #fff1d6; color: #a86500; }
.tag-digest { background: #e3f5e9; color: #22763d; }
.tag-lock { background: #eceff3; color: #5b6573; }
.tag-del, .tag-new { background: #fde5e3; color: #b3261e; }

.tabs { display: flex; gap: 4px; margin-bottom: -1px; align-items: flex-end; }
.tabs a:not(.btn) { padding: 7px 16px; border: 1px solid transparent; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: var(--panel); border-color: var(--line); border-bottom-color: var(--panel); color: var(--text); font-weight: 600; }
.tabs .right { margin-left: auto; margin-bottom: 6px; }
.tabs + .panel { border-top-left-radius: 0; }

/* hot topics */
ol.hot { list-style: none; margin: 0; padding: 0; }
ol.hot li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
ol.hot li:last-child { border-bottom: 0; }
ol.hot li > a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.hot.big li { align-items: flex-start; padding: 10px 0; }
.hot-title { font-size: 1.02rem; font-weight: 600; }
.rank { flex: none; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 4px; background: #aab4c0; color: #fff; font-size: .8rem; font-weight: 700; }
.rank-1 { background: #e53e3e; } .rank-2 { background: #ed8936; } .rank-3 { background: #ecc94b; }

/* board header */
.board-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.board-head h1 { margin: 0 0 4px; }
.board-head p { margin: 2px 0; }
.board-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* topic view */
.topic-head h1 { margin: 0 0 4px; font-size: 1.3rem; }
.topic-head p { margin: 0; }
.modbar { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.modbar select { display: inline-block; width: auto; margin: 0; padding: 2px 6px; font-size: .85rem; }
.modbar-label { font-size: .8rem; color: var(--muted); }
.post { display: grid; grid-template-columns: 130px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); }
.post:target { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.post.deleted { opacity: .7; }
.post-author { padding: 14px 10px; border-right: 1px solid var(--line); text-align: center; background: var(--bg); border-radius: var(--radius) 0 0 var(--radius); word-break: break-all; }
.author-name { font-weight: 600; }
.avatar { display: inline-block; flex: none; text-align: center; width: 46px; height: 46px; line-height: 46px; border-radius: 50%; background: var(--brand); color: #fff !important; font-weight: 700; font-size: 1.2rem; text-transform: uppercase; text-decoration: none !important; margin-bottom: 4px; }
.avatar.big { width: 72px; height: 72px; line-height: 72px; font-size: 1.8rem; }
.post-body { padding: 10px 16px; display: flex; flex-direction: column; min-width: 0; }
.post-meta { display: flex; gap: 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
.floor { font-weight: 600; color: var(--brand); font-size: .88rem; }
.permalink { margin-left: auto; }
.post-content { white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; flex: 1; }
.post-content .quote, .signature .quote { color: var(--quote); }
.post-content .quote-head { color: var(--quote); }
.mention { font-weight: 600; }
.signature { margin-top: 14px; padding-top: 8px; color: var(--muted); font-size: .85rem; border-top: 1px dashed var(--line); }
.post-actions { margin-top: 10px; display: flex; gap: 14px; font-size: .85rem; justify-content: flex-end; }
@media (max-width: 640px) {
  .post { grid-template-columns: 1fr; }
  .post-author { border-right: 0; border-bottom: 1px solid var(--line); text-align: left; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: var(--radius) var(--radius) 0 0; }
  .post-author .avatar { width: 30px; height: 30px; line-height: 30px; font-size: .9rem; margin: 0; }
}
.reply-box textarea { margin-bottom: 8px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 12px 0 18px; }
.pager a, .pager span.cur, .pager .gap { padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); font-size: .88rem; }
.pager span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .gap { border: 0; background: none; }
.pager .muted { margin-left: 6px; font-size: .85rem; }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.notes li.unread { font-weight: 600; }
.notes li.unread::before { content: "● "; color: #e53e3e; }

.profile { text-align: center; }
.profile h1 { margin: 6px 0 0; }
dl.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; text-align: left; margin: 12px 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.error-panel { max-width: 560px; margin: 40px auto; text-align: center; padding: 30px; }

/* admin */
.admin-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding-top: 18px; padding-bottom: 30px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 70px; align-self: start; }
.admin-nav a { padding: 8px 14px; border-radius: 6px; color: var(--text); }
.admin-nav a:hover { background: var(--panel); text-decoration: none; }
.admin-nav a.active { background: var(--brand); color: #fff; }
.admin-main { min-width: 0; }
.admin-main:only-child { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; position: static; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-num { font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat-label { color: var(--muted); font-size: .88rem; }
.danger-zone { border-color: #f1b8b1; }
