/* ==========================================================================
   Windows Cool 论坛样式 — 三栏紧凑社区布局
   深色令牌成对出现（系统自动 + 手动 data-theme），修改时需同步两处。
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #f5f7f9;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --hover: #f4f6f8;
    --border: #e8ebef;
    --border-strong: #d8dee5;
    --text: #1b1f24;
    --text-2: #4d5661;
    --text-3: #737c87;
    --link: #1a6fc4;
    --link-hover: #12558f;
    --accent: #1a6fc4;
    --accent-soft: #edf4fc;
    --danger: #c8342c;
    --danger-soft: #fdeeec;
    --success: #1a7f37;
    --success-soft: #eaf6ee;
    --hot: #d03050;
    --hot-soft: #fdeef1;
    --radius: 4px;
    --radius-lg: 6px;
    --topbar-h: 50px;
    --shadow: 0 1px 2px rgba(27, 31, 36, .04);
    --c0: #1a6fc4; --c1: #c2562c; --c2: #2f8f4e; --c3: #b07a12;
    --c4: #8b3a8f; --c5: #178a80; --c6: #c04f7d; --c7: #6b4fd8;
    --c0-soft: #e8f1fb; --c1-soft: #fbeee8; --c2-soft: #e9f5ec; --c3-soft: #fbf3e2;
    --c4-soft: #f6ecf6; --c5-soft: #e5f5f3; --c6-soft: #fbeaf1; --c7-soft: #eeecfd;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #101316;
        --surface: #171b1f;
        --surface-2: #1d2227;
        --hover: #21262c;
        --border: #282e35;
        --border-strong: #3a424b;
        --text: #e7eaee;
        --text-2: #b0b8c1;
        --text-3: #8f98a2;
        --link: #64b0e8;
        --link-hover: #8ac5f0;
        --accent-soft: #1a2b3a;
        --danger: #e07068;
        --danger-soft: #3a2320;
        --success: #58b97b;
        --success-soft: #17301f;
        --hot: #ef7a8c;
        --hot-soft: #3a2228;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
        --c0: #6cb0e8; --c1: #e08a63; --c2: #5fbf7f; --c3: #d8a74f;
        --c4: #c07fc4; --c5: #45bdb0; --c6: #e08cb0; --c7: #9b8bf0;
        --c0-soft: #1a2b3a; --c1-soft: #33231c; --c2-soft: #182b20; --c3-soft: #2e2517;
        --c4-soft: #2b1f2c; --c5-soft: #15302d; --c6-soft: #321f28; --c7-soft: #232041;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #101316;
    --surface: #171b1f;
    --surface-2: #1d2227;
    --hover: #21262c;
    --border: #282e35;
    --border-strong: #3a424b;
    --text: #e7eaee;
    --text-2: #b0b8c1;
    --text-3: #8f98a2;
    --link: #64b0e8;
    --link-hover: #8ac5f0;
    --accent-soft: #1a2b3a;
    --danger: #e07068;
    --danger-soft: #3a2320;
    --success: #58b97b;
    --success-soft: #17301f;
    --hot: #ef7a8c;
    --hot-soft: #3a2228;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --c0: #6cb0e8; --c1: #e08a63; --c2: #5fbf7f; --c3: #d8a74f;
    --c4: #c07fc4; --c5: #45bdb0; --c6: #e08cb0; --c7: #9b8bf0;
    --c0-soft: #1a2b3a; --c1-soft: #33231c; --c2-soft: #182b20; --c3-soft: #2e2517;
    --c4-soft: #2b1f2c; --c5-soft: #15302d; --c6-soft: #321f28; --c7-soft: #232041;
    color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Variable Text",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 600; margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(26, 111, 196, .25); border-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- 工具类 ---------- */

.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 200;
    background: var(--accent); color: #fff; padding: 7px 14px; border-radius: var(--radius);
    transition: top .15s ease;
}
.skip-link:focus { top: 8px; color: #fff; }
.inline-form { display: inline; }
.link-btn {
    background: none; border: 0; padding: 0; color: var(--text-3); cursor: pointer;
    font: inherit; font-size: 12px;
}
.link-btn:hover { color: var(--link); }

.c0 { --dot: var(--c0); --dot-soft: var(--c0-soft); }
.c1 { --dot: var(--c1); --dot-soft: var(--c1-soft); }
.c2 { --dot: var(--c2); --dot-soft: var(--c2-soft); }
.c3 { --dot: var(--c3); --dot-soft: var(--c3-soft); }
.c4 { --dot: var(--c4); --dot-soft: var(--c4-soft); }
.c5 { --dot: var(--c5); --dot-soft: var(--c5-soft); }
.c6 { --dot: var(--c6); --dot-soft: var(--c6-soft); }
.c7 { --dot: var(--c7); --dot-soft: var(--c7-soft); }
.cat-dot {
    width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
    background: var(--dot, var(--accent)); display: inline-block;
}
.cat-dot.sm { width: 6px; height: 6px; flex-basis: 6px; }
.cat-dot.lg { width: 12px; height: 12px; flex-basis: 12px; }

.avatar {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--dot-soft, var(--surface-2)); color: var(--dot, var(--text-2));
    font-weight: 600; font-size: 14px;
    text-transform: uppercase; user-select: none;
}
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 11.5px; }
.avatar.xs { width: 20px; height: 20px; flex-basis: 20px; font-size: 10px; border-radius: 3px; }
.avatar.lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 17px; border-radius: var(--radius-lg); }

.pill {
    display: inline-flex; align-items: center; font-size: 11px; line-height: 1.7;
    padding: 0 6px; border-radius: 3px; background: var(--hover); color: var(--text-3);
    font-weight: 500;
}
.pill-hot { background: var(--hot-soft); color: var(--hot); }
.pill-op { background: var(--accent); color: #fff; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
    border-radius: var(--radius); padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--link-hover); border-color: var(--link-hover); color: #fff; }
.btn.subtle { background: transparent; }
.btn.subtle:hover { color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.block { display: flex; width: 100%; }
.btn.lg { padding: 9px 18px; font-size: 14px; }

/* ---------- 顶栏 ---------- */

.topbar {
    position: sticky; top: 0; z-index: 90;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex; align-items: center; gap: 16px;
    max-width: 1200px; margin: 0 auto; height: var(--topbar-h); padding: 0 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); flex: 0 0 auto; }
.brand:hover { color: var(--text); }
.brand-mark {
    width: 18px; height: 18px; flex: 0 0 18px; border-radius: 3px;
    background: conic-gradient(#f25022 0 90deg, #7fba00 90deg 180deg, #ffb900 180deg 270deg, #00a4ef 270deg);
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand-slogan { font-size: 12px; color: var(--text-3); font-weight: 400; }

.topnav { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.topnav a { padding: 5px 9px; border-radius: var(--radius); font-size: 13px; color: var(--text-2); }
.topnav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.topnav a.is-active { color: var(--link); font-weight: 500; }

.topbar-search { flex: 1 1 auto; min-width: 0; max-width: 300px; margin-left: auto; }
.search-box { position: relative; display: flex; align-items: center; min-width: 0; }
.search-box svg { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
.search-input {
    width: 100%; min-width: 0; padding: 5px 10px 5px 30px; font: inherit; font-size: 13px;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color .12s ease, background .12s ease;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { outline: none; background: var(--surface); border-color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius);
    border: 1px solid transparent; background: none; color: var(--text-3); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.user-chip { display: inline-flex; align-items: center; gap: 6px; }
.user-chip-name { font-size: 13px; color: var(--text-2); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-link {
    background: none; border: 0; padding: 5px 2px; font: inherit; font-size: 13px;
    color: var(--text-2); cursor: pointer; text-decoration: none;
}
.topbar-link:hover { color: var(--link); text-decoration: none; }
.topbar-link.is-active { color: var(--link); font-weight: 500; }
[data-theme-toggle] .ico-sun { display: none; }
[data-theme-toggle] .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) [data-theme-toggle] .ico-sun { display: block; }
    :root:not([data-theme="light"]) [data-theme-toggle] .ico-moon { display: none; }
}
:root[data-theme="dark"] [data-theme-toggle] .ico-sun { display: block; }
:root[data-theme="dark"] [data-theme-toggle] .ico-moon { display: none; }

/* ---------- 三栏骨架 ---------- */

.page {
    display: grid; grid-template-columns: 212px minmax(0, 1fr) 284px;
    gap: 14px; align-items: start;
    max-width: 1200px; margin: 0 auto; padding: 14px 16px 40px;
}
.main { min-width: 0; }

.rail { min-width: 0; }
.rail-left { position: sticky; top: calc(var(--topbar-h) + 14px); }
.rail-right { position: sticky; top: calc(var(--topbar-h) + 14px); display: flex; flex-direction: column; gap: 12px; }
.rail-right .card + .card { margin-top: 0; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card + .card { margin-top: 10px; }
.card-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-3);
    letter-spacing: .02em;
}
.card-body { padding: 0 0 8px; }

.side-section { padding-bottom: 8px; }
.side-section + .side-section { border-top: 1px solid var(--border); }
.side-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px 5px; font-size: 11.5px; font-weight: 600; color: var(--text-3);
    letter-spacing: .03em;
}
.side-title .n { font-weight: 400; font-variant-numeric: tabular-nums; }

/* 左侧导航 */

.side-list { display: flex; flex-direction: column; }
.side-link {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 14px; font-size: 13px; color: var(--text-2); line-height: 1.7;
    border-left: 2px solid transparent;
}
.side-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-link.is-active {
    background: var(--accent-soft); border-left-color: var(--accent);
    color: var(--link); font-weight: 600;
}
.side-link .label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link .count { flex: 0 0 auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side-link.is-active .count { color: var(--link); opacity: .7; }
.side-link svg { flex: 0 0 14px; opacity: .65; }
.side-head {
    display: flex; align-items: center; gap: 6px; width: 100%;
    padding: 9px 12px 4px; background: none; border: 0; cursor: pointer;
    font: inherit; font-size: 12px; font-weight: 600; color: var(--text-3); text-align: left;
}
.side-head .chevron { margin-left: auto; transition: transform .15s ease; }
.side-group.is-collapsed .chevron { transform: rotate(-90deg); }
.side-group.is-collapsed .side-nav { display: none; }
.side-empty { padding: 4px 12px 8px; font-size: 12px; color: var(--text-3); }

/* 发帖之星 */

.star-row { display: flex; align-items: center; gap: 8px; padding: 5px 12px; }
.star-row:hover { background: var(--hover); }
.star-rank {
    flex: 0 0 16px; font-size: 11px; color: var(--text-3); text-align: center;
    font-variant-numeric: tabular-nums;
}
.star-row:first-child .star-rank { color: var(--hot); font-weight: 700; }
.star-name {
    flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--text-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.star-count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 右侧用户卡 */

.user-card { padding: 14px; }
.user-card-head { display: flex; align-items: center; gap: 10px; }
.user-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-card-name:hover { color: var(--link); }
.user-card-sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.user-card-stats {
    display: flex; align-items: baseline; gap: 5px;
    margin: 10px 0 12px; font-size: 12px; color: var(--text-3);
}
.user-card-stats b { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.user-card-stats .sep { color: var(--border-strong); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; margin-bottom: 12px; }
.quick-grid form {
    grid-column: 1 / -1; margin: 4px 0 0; padding-top: 6px;
    border-top: 1px solid var(--border);
}
.quick-grid a, .quick-grid button {
    display: block; padding: 4px 0; font-size: 12.5px; color: var(--text-2);
    background: none; border: 0; text-align: left; cursor: pointer; font-family: inherit;
}
.quick-grid a:hover, .quick-grid button:hover { color: var(--link); text-decoration: none; }
.guest-card { padding: 16px 14px; text-align: center; }
.guest-card p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-3); }

.stat-list { padding: 2px 12px 10px; }
.stat-list div {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 0; font-size: 12.5px; color: var(--text-3);
}
.stat-list b { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

.tip-card { padding: 12px 14px; }
.tip-card h3 { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.tip-card p { margin: 0 0 5px; font-size: 12px; color: var(--text-3); line-height: 1.65; }

/* ---------- 内容面板 ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel + .panel { margin-top: 12px; }
.panel-tabs {
    display: flex; align-items: center; gap: 16px;
    padding: 0 14px; height: 42px; border-bottom: 1px solid var(--border);
}
.tabs { display: flex; align-items: center; gap: 18px; height: 100%; }
.tab {
    display: inline-flex; align-items: center; height: 100%;
    font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent;
    margin-bottom: -1px; padding: 0 1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--link); font-weight: 600; border-bottom-color: var(--accent); }
.panel-meta { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.panel-title { font-size: 13.5px; font-weight: 600; color: var(--text); }

.page-head { display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 46px; border-bottom: 1px solid var(--border); }
.panel > .page-head:last-child { border-bottom: 0; }
.page-head > div { flex: 1 1 auto; min-width: 0; }
.page-title { font-size: 15px; font-weight: 600; }
.page-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 2px 8px; }
.crumbs {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 2px 2px 10px; font-size: 12.5px; color: var(--text-3);
}
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--link); }
.crumbs span { color: var(--border-strong); }
.panel > .crumbs { padding: 12px 16px 0; }
.crumbs + .topic-head, .crumbs + .board-head { padding-top: 12px; }

/* ---------- 主题列表 ---------- */

.topic-list { list-style: none; margin: 0; padding: 0; }
.topic-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    transition: background .1s ease;
}
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--surface-2); }
.topic-avatar { padding-top: 1px; }
.topic-body { flex: 1 1 auto; min-width: 0; }
.topic-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.topic-title {
    font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.5;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.topic-title:hover { color: var(--link); }
.topic-meta {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin-top: 3px; font-size: 12px; color: var(--text-3);
}
.topic-meta a { color: var(--text-3); }
.topic-meta a:hover { color: var(--link); }
.topic-meta .sep { color: var(--border-strong); }
.topic-author { color: var(--text-2); }
.topic-replies { font-variant-numeric: tabular-nums; }
.topic-replies b { font-weight: 600; color: var(--text-2); }
.topic-tag {
    display: inline-flex; align-items: center; height: 17px; padding: 0 4px;
    border-radius: 3px; font-size: 11px; font-weight: 500; white-space: nowrap;
    background: var(--hover); color: var(--text-3);
}
.topic-tag.hot { background: var(--hot-soft); color: var(--hot); }
.topic-tag.new { background: var(--success-soft); color: var(--success); }
.topic-tag.ask { background: var(--accent-soft); color: var(--link); }
.topic-side {
    flex: 0 0 88px; text-align: right; font-size: 12px; color: var(--text-3);
    padding-top: 2px; white-space: nowrap;
}
.topic-side a { color: var(--text-2); }
.topic-side a:hover { color: var(--link); }
.topic-side .board-name {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
}
.topic-side .board-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.topic-last { display: block; margin-top: 1px; font-size: 11px; color: var(--text-3); }
.topic-side .reply-num { display: none; }

/* 兼容旧列表结构 */
.topic-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: none; }
.topic-main { min-width: 0; flex: 1 1 auto; }
.topic-num { display: none; }
.people { display: flex; align-items: center; }
.people .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.people .avatar:first-child { margin-left: 0; }
.cat-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 0 6px;
    border-radius: 3px; background: var(--hover); color: var(--text-2); font-size: 11.5px;
    line-height: 1.7;
}
a.cat-badge:hover { background: var(--accent-soft); color: var(--link); text-decoration: none; }
.cat-badge.is-plain { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-3); }

/* 板块条 */

.board-strip {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.board-chip {
    display: flex; align-items: center; gap: 7px; padding: 9px 12px;
    background: var(--surface); font-size: 12.5px; color: var(--text-2);
}
.board-chip:hover { background: var(--surface-2); color: var(--link); text-decoration: none; }
.board-chip .label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-chip .count { font-size: 11px; color: var(--text-3); }

/* 板块页头部 */

.board-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 14px; border-bottom: 1px solid var(--border); }
.board-head-dot { width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius); background: var(--dot, var(--accent)); }
.board-head-text { flex: 1 1 auto; min-width: 0; }
.board-title { font-size: 16px; font-weight: 600; }
.board-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.board-stat { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* 兼容旧板块结构 */
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.board-card-head { display: flex; align-items: flex-start; gap: 8px; }
.board-card-titles { flex: 1 1 auto; min-width: 0; }
.board-card-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.board-card-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.board-card-count { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.board-card-topics { list-style: none; margin: 8px 0 0; padding: 0; }
.board-card-topics li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12.5px; }
.board-card-topics a { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card-topics time { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.board-card-empty, .board-card-foot { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ---------- 主题详情 ---------- */

.topic-head { padding: 16px 16px 14px; border-bottom: 1px solid var(--border); }
.topic-page-title { font-size: 19px; font-weight: 600; line-height: 1.45; margin-bottom: 8px; }
.topic-head-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }

.post-row { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.post-row:last-child { border-bottom: 0; }
.post-row:target { background: var(--accent-soft); }
.post-side { flex: 0 0 36px; }
.post-content { flex: 1 1 auto; min-width: 0; }
.post-info { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--text-3); }
.post-info .p-name { font-size: 13px; font-weight: 600; color: var(--text-2); }
.post-info .link-btn { margin-left: auto; }
.p-meta { font-variant-numeric: tabular-nums; }
.reply-heading {
    font-size: 13px; font-weight: 600; color: var(--text-2);
    padding: 14px 16px 8px; border-top: 1px solid var(--border);
}
.login-to-reply {
    margin: 0 16px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
    padding: 16px; text-align: center; font-size: 13px; color: var(--text-3);
}
.reply-form { padding: 0 16px 16px; }

/* ---------- 富文本 ---------- */

.rich { font-size: 14px; line-height: 1.8; word-wrap: break-word; overflow-wrap: break-word; }
.post-body.is-topic { font-size: 15px; line-height: 1.85; }
.post-body.is-reply { font-size: 14px; line-height: 1.75; }
.rich > *:first-child { margin-top: 0; }
.rich > *:last-child { margin-bottom: 0; }
.rich p { margin: 0 0 10px; }
.rich h1, .rich h2, .rich h3, .rich h4 { margin: 18px 0 8px; }
.rich h1 { font-size: 20px; }
.rich h2 { font-size: 17px; }
.rich h3 { font-size: 15px; }
.rich h4 { font-size: 14px; }
.rich ul, .rich ol { margin: 0 0 10px; padding-left: 22px; }
.rich li { margin: 2px 0; }
.rich blockquote {
    margin: 10px 0; padding: 3px 12px; color: var(--text-2);
    border-left: 3px solid var(--border-strong); background: var(--surface-2);
}
.rich img { max-width: 100%; height: auto; border-radius: var(--radius); }
.rich code { background: var(--hover); padding: 1px 4px; border-radius: 3px; }
.rich pre { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--radius); overflow-x: auto; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.rich a { text-decoration: underline; text-underline-offset: 2px; }
.rich .fs-14 { font-size: 14px; }
.rich .fs-16 { font-size: 16px; }
.rich .fs-20 { font-size: 20px; }
.editor .fs-14 { font-size: 14px; }
.editor .fs-16 { font-size: 16px; }
.editor .fs-20 { font-size: 20px; }

/* ---------- 编辑器与表单 ---------- */

.editor-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1px;
    padding: 4px 5px; background: var(--surface-2);
    border: 1px solid var(--border); border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
}
.tool-btn {
    min-width: 28px; padding: 2px 7px; font: inherit; font-size: 12.5px;
    background: transparent; color: var(--text-2); border: 1px solid transparent;
    border-radius: 3px; cursor: pointer;
}
.tool-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.tool-btn i { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.tool-sep { width: 1px; height: 14px; margin: 0 3px; background: var(--border); }
.editor {
    min-height: 180px; padding: 10px 12px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
    outline: none; font-size: 14px; line-height: 1.75;
}
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26, 111, 196, .12); }
.editor:empty::before { content: attr(placeholder); color: var(--text-3); }
.reply-form .editor { min-height: 110px; }

.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.field-label { display: block; margin-bottom: 4px; font-weight: 500; color: var(--text-2); font-size: 12.5px; }
.field-input {
    display: block; width: 100%; padding: 6px 9px; font: inherit; font-size: 13px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    transition: border-color .12s ease;
}
.field-input:hover { border-color: var(--text-3); }
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26, 111, 196, .12); }
.field-input.sm { width: auto; min-width: 120px; display: inline-block; padding: 3px 7px; font-size: 12.5px; }
.field-input.xs { width: 60px; display: inline-block; padding: 3px 7px; font-size: 12.5px; }
.field-hint { display: block; margin-top: 3px; font-size: 11.5px; color: var(--text-3); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.field-inline { display: flex; align-items: center; gap: 8px; }
.field-inline .field-label { margin-bottom: 0; }
.form-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.form-foot .form-hint { margin-right: auto; }
.form-hint { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.form-hint.is-over { color: var(--danger); font-weight: 600; }
.form-section-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-2); }
.chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }

.card-form, .admin-form {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
}
.stack-form { margin-top: 14px; }
.post-form-title .field-input { font-size: 15px; padding: 8px 10px; }
.post-form-title { margin-bottom: 8px; }
.cf-turnstile { margin: 8px 0; }

/* ---------- 提示 / 空状态 / 分页 ---------- */

.alert {
    position: relative; display: block; margin: 0 0 10px; padding: 8px 34px 8px 12px;
    border-radius: var(--radius); font-size: 13px; border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-close {
    position: absolute; top: 5px; right: 7px; border: 0; background: none; cursor: pointer;
    color: inherit; font-size: 16px; line-height: 1; opacity: .55;
}
.alert-close:hover { opacity: 1; }
.main > .alert:first-child { margin-top: 0; }

.empty { color: var(--text-3); padding: 16px; font-size: 13px; }
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 40px 16px; text-align: center; color: var(--text-3);
}
.empty-state .btn { margin-top: 10px; }
.empty-title { font-size: 14px; color: var(--text-2); }
.empty-text { font-size: 12.5px; margin: 0; }

.pager { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.pager-btn, .pager-num {
    display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px;
    padding: 0 8px; font-size: 12.5px; color: var(--text-2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.pager-num { font-variant-numeric: tabular-nums; }
.pager-btn:hover, .pager-num:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.pager-num.is-current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager-btn.is-disabled { color: var(--text-3); opacity: .55; pointer-events: none; }
.pager-gap { color: var(--text-3); padding: 0 2px; }
.pager-info { margin-left: 6px; font-size: 12px; color: var(--text-3); }

/* ---------- 管理后台 ---------- */

.admin-tabs {
    display: flex; gap: 18px; padding: 0 14px; height: 42px;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--radius); margin-bottom: 12px;
}
.admin-tabs a {
    display: inline-flex; align-items: center; gap: 6px; height: 100%;
    font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-tabs a:hover { color: var(--text); text-decoration: none; }
.admin-tabs a.active { color: var(--link); font-weight: 600; border-bottom-color: var(--accent); }
.admin-tabs span { font-size: 10.5px; padding: 0 5px; border-radius: 3px; background: var(--hover); color: var(--text-3); }

.admin-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th, .admin-table td {
    text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.admin-table th { background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.col-check { width: 30px; }
.col-actions { text-align: right; white-space: nowrap; }
.table-empty { text-align: center; color: var(--text-3); padding: 24px 0 !important; }
.cell-user { display: inline-flex; align-items: center; gap: 6px; }
.inline-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.bulk-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.bulk-hint { font-size: 12px; color: var(--text-3); }
.select-box { position: fixed; border: 1px solid var(--accent); background: rgba(26, 111, 196, .1); z-index: 60; pointer-events: none; }
.board-groups {
    width: 100%; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
}
.board-groups .field-label { width: 100%; margin-bottom: 0; }
.admin-form { margin-top: 12px; }

/* ---------- 独立页（登录 / 注册 / 安装） ---------- */

.layout-blank { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.blank-main {
    flex: 1 1 auto; width: 100%; max-width: 380px; margin: 0 auto; padding: 64px 16px 40px;
    display: flex; flex-direction: column; justify-content: center; gap: 16px;
}
.brand-lg { justify-content: center; font-size: 17px; margin-bottom: 2px; }
.blank-footer { padding: 14px; text-align: center; font-size: 11.5px; color: var(--text-3); }
.page-center { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.page-center .auth-card { margin: 0; width: 100%; max-width: 380px; }

.auth-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 22px 22px 18px; box-shadow: var(--shadow);
}
.auth-title { font-size: 17px; font-weight: 600; }
.auth-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.auth-alt { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
.install-card { max-width: 100%; }
.install-steps { display: flex; gap: 6px; margin: 16px 0 14px; padding: 0; list-style: none; counter-reset: step; }
.install-steps .step {
    flex: 1 1 0; font-size: 11.5px; color: var(--text-3); padding: 6px 8px 6px 26px; position: relative;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.install-steps .step::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; border-radius: 50%; background: var(--border); color: var(--surface);
    font-size: 10px; line-height: 14px; text-align: center;
}
.install-steps .is-done { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.install-steps .is-done::before { background: var(--success); color: #fff; content: "\2713"; }
.install-steps .is-active { color: var(--link); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.install-steps .is-active::before { background: var(--accent); color: #fff; }

/* ---------- 页脚 ---------- */

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    max-width: 1280px; margin: 0 auto; padding: 14px 16px;
    font-size: 12px; color: var(--text-3);
}
.footer-brand { font-weight: 600; color: var(--text-2); }
.footer-sep { color: var(--border-strong); }
.footer-spacer { flex: 1 1 auto; }
.beian { color: var(--text-3); }
.beian:hover { color: var(--link); }

/* ---------- 轻提示 ---------- */

.toast-host {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.toast {
    background: var(--text); color: var(--surface); font-size: 12.5px;
    padding: 7px 14px; border-radius: var(--radius); box-shadow: var(--shadow);
    animation: toast-in .18s ease-out;
}
.toast.is-out { opacity: 0; transition: opacity .24s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
    .page { grid-template-columns: 192px minmax(0, 1fr) 252px; gap: 12px; }
    .brand-slogan { display: none; }
}

@media (max-width: 1020px) {
    .page { grid-template-columns: 192px minmax(0, 1fr); }
    .rail-right { display: none; }
    .topnav { display: none; }
    .topbar-search { max-width: none; }
}

@media (max-width: 860px) {
    .page { display: block; padding: 10px 12px 32px; }
    .rail-left { position: static; margin-bottom: 12px; }
    .side-section--stars { display: none; }
    .side-title { padding: 10px 12px 4px; }
    .side-section { padding-bottom: 6px; }
    .side-list { flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0 10px 2px; }
    .side-link {
        border-left: 0; padding: 4px 9px; border-radius: var(--radius);
        background: var(--surface-2); font-size: 12.5px;
    }
    .side-link.is-active { background: var(--accent-soft); border-left-color: transparent; }
    .side-link .count { margin-left: 3px; }
    .brand-slogan, .user-chip-name { display: none; }
    .topbar-inner { gap: 10px; }
    .board-strip { grid-template-columns: 1fr 1fr; }
    .board-grid { grid-template-columns: 1fr; }
    .topic-side { flex-basis: 76px; }
    .panel-meta { display: none; }
}

@media (max-width: 560px) {
    body { font-size: 13.5px; }
    .topbar-inner { padding: 0 10px; gap: 8px; }
    .brand-name { display: none; }
    .topbar-search { flex: 1 1 40px; max-width: none; }
    .page { padding: 8px 10px 28px; }
    .topic-row { padding: 9px 10px; gap: 8px; }
    .topic-title { font-size: 13.5px; white-space: normal; }
    .topic-side { display: none; }
    .topic-meta { font-size: 11.5px; gap: 5px; }
    .panel-tabs, .page-head { padding: 0 10px; }
    .topic-head, .post-row { padding: 12px; }
    .board-strip { grid-template-columns: 1fr; }
    .blank-main { padding: 32px 14px 24px; }
    .install-steps { flex-direction: column; }
}
