/* ============================================================
   大千世界论坛 · 样式表
   无构建步骤，直接引入即可；变量集中在 :root，方便换主题。
   ============================================================ */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e3e6eb;
    --border-strong: #d3d8e0;
    --text: #1c2028;
    --text-2: #5a6472;
    --text-3: #8b94a3;
    --primary: #3b6ef5;
    --primary-dark: #2b57d0;
    --primary-soft: #eef2ff;
    --danger: #d64545;
    --danger-soft: #fdeeee;
    --success: #1f9d63;
    --success-soft: #eaf7f0;
    --warning: #b8791b;
    --warning-soft: #fdf4e3;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(20, 26, 38, .05);
    --shadow: 0 1px 3px rgba(20, 26, 38, .07), 0 6px 18px rgba(20, 26, 38, .04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
            "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover { color: var(--primary-dark); }

h1, h2, h3, p, ul, ol { margin: 0; }

ul { list-style: none; padding: 0; }

code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

.muted { color: var(--text-3); }
.small { font-size: 13px; }

/* ---------------- 头部 ---------------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    flex-shrink: 0;
}

.logo-text {
    letter-spacing: -.2px;
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #6c8cff);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 14px;
    transition: background .15s, color .15s;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-link.is-active {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ---------------- 头部搜索 ---------------- */

.header-search {
    flex-shrink: 0;
    width: 180px;
}

.header-search input[type="search"] {
    width: 100%;
    padding: 6px 11px;
    font-size: 13px;
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.header-search input[type="search"]:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 110, 245, .12);
    outline: none;
}

/* ---------------- 搜索页 ---------------- */

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    gap: 10px;
    align-items: center;
}

.search-form input[type="search"] {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
}

.search-summary {
    margin-bottom: 14px;
}

.search-summary b { color: var(--text); }

.search-snippet {
    font-size: 13px;
    line-height: 1.6;
    margin: 3px 0 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

.avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

/* ---------------- 主体 ---------------- */

.main {
    padding: 26px 20px 56px;
    min-height: calc(100vh - 160px);
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 18px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}

.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------------- 卡片 ---------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 18px;
}

.card-head {
    margin-bottom: 16px;
}

.card-head-split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 16px;
    font-weight: 650;
}

.card-sub {
    font-size: 13px;
    margin-top: 4px;
}

/* ---------------- 首屏 ---------------- */

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 22px 24px;
    margin-bottom: 18px;
    background: linear-gradient(120deg, #ffffff, #f0f4ff);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.hero-title {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.2px;
}

.hero-sub {
    font-size: 13.5px;
    margin-top: 6px;
}

.hero-stats {
    display: flex;
    gap: 26px;
}

.stat b {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.stat span {
    font-size: 12px;
    color: var(--text-3);
}

.layout-2col {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.layout-2col > .card { margin-bottom: 0; }

/* ---------------- 版块列表 ---------------- */

.board-list { display: flex; flex-direction: column; }

.board-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.board-item:last-child { border-bottom: 0; padding-bottom: 0; }
.board-item:first-child { padding-top: 0; }

.board-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.board-name {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.board-main:hover .board-name { color: var(--primary); }

.board-desc {
    font-size: 12.5px;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-size: 12px;
}

.meta-pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1px 9px;
    color: var(--text-2);
    white-space: nowrap;
}

.meta-time { min-width: 62px; text-align: right; }

/* ---------------- 列表 ---------------- */

.latest-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.latest-list li:last-child { border-bottom: 0; }

.latest-list a {
    display: block;
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.latest-list a:hover { color: var(--primary); }

.latest-meta {
    display: flex;
    gap: 6px;
    font-size: 12px;
    margin-top: 2px;
}

.simple-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.simple-list li:last-child { border-bottom: 0; }

.simple-list a {
    color: var(--text);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-list a:hover { color: var(--primary); }

/* ---------------- 主题列表 ---------------- */

.topic-list { display: flex; flex-direction: column; }

.topic-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.topic-item:last-child { border-bottom: 0; padding-bottom: 0; }
.topic-item:first-child { padding-top: 0; }

.topic-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.topic-avatar.lg { width: 42px; height: 42px; font-size: 16px; }
.topic-avatar.xl { width: 62px; height: 62px; font-size: 24px; }

.topic-body { flex: 1; min-width: 0; }

.topic-title {
    display: block;
    font-size: 15px;
    font-weight: 550;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-title:hover { color: var(--primary); }

.topic-meta {
    display: flex;
    gap: 6px;
    font-size: 12px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.topic-last {
    font-size: 12px;
    min-width: 64px;
    text-align: right;
    flex-shrink: 0;
}

.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    margin-right: 5px;
    vertical-align: 1px;
}

.tag-pin {
    background: var(--primary-soft);
    border-color: #d6e0ff;
    color: var(--primary-dark);
}

.tag-lock {
    background: var(--warning-soft);
    border-color: #f2e2bd;
    color: var(--warning);
}

/* ---------------- 帖子详情 ---------------- */

.post { padding: 22px; }

.post-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 11px;
}

.post-author-name {
    font-weight: 600;
    color: var(--text);
    font-size: 14.5px;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.post-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    margin: 16px 0 12px;
    letter-spacing: -.2px;
}

.post-content {
    font-size: 15px;
    line-height: 1.85;
    color: #262b35;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.post-foot {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ---------------- 回帖 ---------------- */

.replies { margin: 22px 0 18px; }

.reply-list { display: flex; flex-direction: column; gap: 10px; }

.reply {
    display: flex;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 17px;
    scroll-margin-top: 76px;
}

.reply:target {
    border-color: #bfd0ff;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.reply-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    width: 44px;
}

.reply-floor { font-size: 11px; }

.reply-main { flex: 1; min-width: 0; }

.reply-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.reply-head a {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text);
}

.reply-content {
    font-size: 14.5px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: #262b35;
}

.reply-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.link-muted {
    color: var(--text-3);
    font-size: 12.5px;
}

.link-muted:hover { color: var(--primary); }

.link-danger { color: var(--text-3); }
.link-danger:hover { color: var(--danger); }

.reply-form { margin-top: 4px; }

/* ---------------- 表单 ---------------- */

.stack-form { display: flex; flex-direction: column; gap: 8px; }
.stack-form > .btn { align-self: flex-start; margin-top: 6px; }
.stack-form .btn-block { align-self: stretch; }

.label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-top: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    resize: vertical;
    line-height: 1.7;
    min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 110, 245, .13);
}

input:disabled {
    background: var(--surface-2);
    color: var(--text-3);
    cursor: not-allowed;
}

input.w-80 { width: 80px; }

.field-hint { margin-top: -4px; }

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    align-items: end;
}

.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; }

.inline-form { display: inline; }

/* ---------------- 按钮 ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 550;
    line-height: 1.3;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: #c3cad4;
}

.btn-danger {
    background: var(--surface);
    border-color: #eccaca;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-sm {
    font-size: 13px;
    padding: 5px 11px;
}

.btn-block { width: 100%; }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
}

.link-btn:hover { color: var(--danger); }

.link-btn.small { font-size: 12.5px; }

.quick-links { display: flex; flex-direction: column; gap: 8px; }
.tips { margin-top: 14px; line-height: 1.7; }

/* ---------------- Flash / 错误 ---------------- */

.flashes { margin-bottom: 14px; }

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.flash-success { background: var(--success-soft); border-color: #c6e9d8; color: #157a4c; }
.flash-error   { background: var(--danger-soft);  border-color: #f2d2d2; color: #a53333; }
.flash-warning { background: var(--warning-soft); border-color: #f0e0bd; color: #8a5a12; }
.flash-info    { background: var(--primary-soft); border-color: #d6e0ff; color: var(--primary-dark); }

.error-list {
    margin: 4px 0 0;
    padding-left: 18px;
    list-style: disc;
    font-size: 13.5px;
}

.error-list li { margin: 1px 0; }

/* ---------------- 分页 ---------------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 18px 0 8px;
    flex-wrap: wrap;
}

.pager-item {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-2);
}

.pager-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pager-item.is-current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.list-note {
    text-align: center;
    font-size: 12.5px;
}

.empty {
    padding: 26px 0;
    text-align: center;
    font-size: 14px;
}

/* ---------------- 个人主页 / 设置 ---------------- */

.profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.profile-info { flex: 1; min-width: 160px; }

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 3px;
}

.profile-stats {
    display: flex;
    gap: 26px;
}

/* ---------------- 表格 ---------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: none;
    padding: 0 10px 9px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table td.num,
.table th.num { text-align: right; }

.table input[type="text"],
.table select {
    padding: 6px 9px;
    font-size: 13.5px;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    white-space: nowrap;
}

.row-disabled td { opacity: .55; }

/* ---------------- 统计卡 ---------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    margin: 0;
    text-align: center;
    padding: 16px;
}

.stat-card b {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}

.stat-card span { font-size: 12.5px; color: var(--text-3); }

/* ---------------- 认证页 ---------------- */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(1000px 400px at 50% -10%, #e8eeff, var(--bg));
    padding: 32px 18px;
}

.auth-shell {
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    margin-bottom: 20px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-sub { margin-bottom: 18px; }

.auth-card .btn-block { margin-top: 14px; }

.auth-switch {
    text-align: center;
    margin-top: 16px;
}

.auth-foot {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}

.auth-foot a { color: var(--text-2); }
.auth-foot a:hover { color: var(--primary); }

.error-card { text-align: center; }
.error-code {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--primary);
    letter-spacing: -1px;
}
.error-msg { margin: 10px 0 20px; color: var(--text-2); font-size: 14.5px; }

/* ---------------- 页脚 ---------------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    font-size: 12.5px;
    color: var(--text-3);
    flex-wrap: wrap;
}

.footer-inner a { color: var(--text-3); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 820px) {
    .layout-2col { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .search-form { grid-template-columns: 1fr; }
    .header-search { width: 140px; }
}

@media (max-width: 620px) {
    .header-inner { gap: 12px; height: auto; padding: 10px 0; flex-wrap: wrap; }
    .nav { order: 3; width: 100%; }
    .header-search { order: 4; width: 100%; }
    .header-search input[type="search"] { border-radius: var(--radius-sm); }
    .user-area { margin-left: auto; }
    .hero { flex-direction: column; align-items: flex-start; }
    .hero-stats { gap: 20px; }
    .board-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .board-meta { font-size: 11.5px; }
    .post-title { font-size: 19px; }
    .topic-last { display: none; }
    .table { font-size: 13px; }
    .row-actions { flex-direction: column; }
}
