/* ============================================================
   校园墙 - 样式表
   世界观：信笺（暖纸底 + 墨色字 + 朱砂点缀）
   模式：Operate —— 应用界面，可读性与一致性优先，装饰克制
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
    /* 纸面与油墨 */
    --paper:      #f5f2ec;
    --paper-deep: #ece8e0;
    --surface:    #fffefb;
    --surface-2:  #f0ece4;
    --ink:        #201d1a;
    --ink-2:      #55504a;
    --ink-3:      #6b645c;
    --line:       #e4ddd3;
    --line-2:     #d3cabd;

    /* 朱砂：仅用于主操作、当前选中、状态指示 */
    --accent:      #b0392b;
    --accent-ink:  #8f2c21;
    --accent-wash: #fbeeea;

    /* 语义色 */
    --ok:        #2f6b46;
    --ok-wash:   #eef6f0;
    --ok-line:   #cfe4d6;
    --warn:      #7a5310;
    --warn-wash: #fdf6e6;
    --warn-line: #ecd9ac;
    --bad:       #8f2c21;
    --bad-wash:  #fdf1ef;
    --bad-line:  #f0d3cd;
    --info:      #2f4a86;
    --info-wash: #eef2fb;
    --info-line: #d3ddf2;

    /* 尺度 */
    --fs-xs:   0.75rem;    /* 12 */
    --fs-sm:   0.8125rem;  /* 13 */
    --fs-ui:   0.875rem;   /* 14 */
    --fs-body: 0.9375rem;  /* 15 */
    --fs-lg:   1.0625rem;  /* 17 */
    --fs-xl:   1.1875rem;  /* 19 */
    --fs-2xl:  1.4375rem;  /* 23 */

    --radius:    10px;
    --radius-sm: 7px;
    --radius-pill: 999px;

    /* 投影：带偏移的柔和阴影，不做零偏移光晕 */
    --shadow-1: 0 1px 2px rgba(32, 29, 26, 0.05), 0 6px 16px -10px rgba(32, 29, 26, 0.14);
    --shadow-2: 0 2px 6px rgba(32, 29, 26, 0.08), 0 24px 48px -24px rgba(32, 29, 26, 0.28);

    --ease: cubic-bezier(0.32, 0.72, 0.28, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    background: var(--paper);
    color: var(--ink);
    font-size: var(--fs-body);
    line-height: 1.65;
    caret-color: var(--accent);
    -webkit-font-smoothing: antialiased;
}

/* 管理后台使用第二层中性色，形成"操作台"与"内容页"的层次 */
body.admin { background: var(--paper-deep); }

/* ---------- 浏览器原生表面：选中 / 焦点 / 滚动条 ---------- */
::selection { background: rgba(176, 57, 43, 0.16); color: var(--ink); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border: 3px solid var(--paper);
    border-radius: var(--radius-pill);
}
body.admin ::-webkit-scrollbar-thumb { border-color: var(--paper-deep); }

/* ---------- 基础排版 ---------- */
a { color: var(--accent); text-decoration: none; }

/* 正文里的链接才带下划线，并用足下划线偏移 */
.auth-tip a,
.empty a,
.login-tip a,
.comment-on a,
.report-target a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

h1, h2, h3 { line-height: 1.35; font-weight: 600; }

.icon { display: inline-block; vertical-align: -0.18em; flex: none; }

.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;
}

.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

main.container { padding-top: 20px; padding-bottom: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 54px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: var(--fs-body);
    font-weight: 700;
    white-space: nowrap;
}
.logo .icon { color: var(--accent); }

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-link {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: var(--fs-ui);
    white-space: nowrap;
    transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }

.user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.user-name {
    color: var(--ink);
    font-size: var(--fs-ui);
    font-weight: 600;
    max-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-name:hover { color: var(--accent); }

/* 后台顶栏：同一套词汇，换一层中性底色 */
.topbar-admin { background: var(--surface-2); border-bottom-color: var(--line-2); }

/* ---------- 按钮：统一形状与状态 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: var(--fs-ui);
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
        color 0.16s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(0.5px); }

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

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
.btn-danger:hover { background: var(--bad-wash); border-color: var(--bad); }

.btn-sm { padding: 5px 10px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink-3);
}
.btn:disabled:hover { background: var(--surface-2); border-color: var(--line); }

.inline-form { display: inline-flex; }

/* ---------- 表单控件 ---------- */
.field { display: block; margin-bottom: 16px; }

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-2);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.field-hint {
    display: block;
    margin-top: 5px;
    color: var(--ink-3);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
/* 字段级错误：就地指出问题，比顶部提示条更贴近用户视线 */
.field-hint.is-error { color: var(--bad); font-weight: 600; }

.required { color: var(--accent); }

.input,
.search-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: var(--fs-body);
    line-height: 1.5;
    transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input::placeholder,
.search-input::placeholder { color: var(--ink-3); opacity: 1; }

.input:hover,
.search-input:hover { border-color: var(--ink-3); }

.input:focus,
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 57, 43, 0.14);
}
.input:focus-visible { outline: none; }

.textarea { resize: vertical; min-height: 88px; }

input[type="file"].input { padding: 7px 10px; font-size: var(--fs-ui); }

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 4px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--ink);
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--ink-3); }

.anon-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-2);
    font-size: var(--fs-ui);
    cursor: pointer;
    user-select: none;
}
.anon-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.image-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.image-preview img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

/* ---------- 卡片（面板基元） ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 16px;
    margin-bottom: 14px;
}

.section-title {
    font-size: var(--fs-lg);
    margin-bottom: 14px;
}

.form-card { max-width: 620px; margin-inline: auto; }
.form-title { font-size: var(--fs-xl); margin-bottom: 18px; }

/* ---------- 登录 / 注册 ---------- */
.auth-card {
    max-width: 400px;
    margin: 40px auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 26px 22px;
}
.auth-title { font-size: var(--fs-2xl); margin-bottom: 18px; }
.auth-tip {
    margin-top: 16px;
    color: var(--ink-3);
    font-size: var(--fs-sm);
    text-align: center;
}

/* ---------- 提示条 ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--ink);
    font-size: var(--fs-ui);
}
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad); }
.alert-success { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok); }
.alert-info { background: var(--info-wash); border-color: var(--info-line); color: var(--info); }

/* ---------- 顶栏下方的一次性提示条（session flash / 前端临时提示） ---------- */
.flash-area { padding-top: 12px; }
.flash-area:empty { display: none; }

.flash {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    font-size: var(--fs-ui);
    animation: flash-in 200ms var(--ease);
}
.flash .flash-icon { margin-top: 2px; }
.flash-text { flex: 1; min-width: 0; word-break: break-word; }

.flash-close {
    display: inline-flex;
    padding: 2px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: currentColor;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.16s var(--ease), background-color 0.16s var(--ease);
}
.flash-close:hover { opacity: 1; background: rgba(32, 29, 26, 0.06); }

.flash-success { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok); }
.flash-error { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad); }
.flash-warning { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.flash-info { background: var(--info-wash); border-color: var(--info-line); color: var(--info); }

.flash.is-leaving { animation: flash-out 180ms var(--ease) forwards; }

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
@keyframes flash-out {
    to { opacity: 0; transform: translateY(-4px); }
}

.login-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 13px;
    margin-bottom: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: var(--fs-ui);
}

/* ---------- 信息流工具栏 ---------- */
.feed-toolbar { margin-bottom: 16px; }

.search-form { display: flex; gap: 8px; margin-bottom: 12px; }
.search-input { flex: 1; min-width: 0; }

/* 段式选择器：导航 / 排序 / 筛选 / 标签页共用同一套选中词汇 */
.sort-tabs,
.filter-tabs,
.tab-bar {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.sort-tabs::-webkit-scrollbar,
.tab-bar::-webkit-scrollbar { display: none; }

.filter-tabs { margin: 0 0 14px; }
.tab-bar { margin-bottom: 16px; }

.sort-tab,
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 5px;
    color: var(--ink-2);
    font-size: var(--fs-ui);
    white-space: nowrap;
    transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
.sort-tab:hover,
.tab:hover { color: var(--ink); }
.sort-tab.active,
.tab.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }

/* ---------- 帖子卡片 ---------- */
.post { padding: 15px 16px 12px; }

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.post-meta { min-width: 0; }
.post-name-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.nickname { font-size: var(--fs-body); font-weight: 600; }

.time {
    color: var(--ink-3);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 50%;
    background: var(--accent-wash);
    border: 1px solid rgba(176, 57, 43, 0.16);
    color: var(--accent-ink);
    font-size: var(--fs-ui);
    font-weight: 600;
    user-select: none;
}
.avatar-anon {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink-3);
}
.avatar-sm { width: 30px; height: 30px; font-size: var(--fs-sm); }
.avatar-lg { width: 52px; height: 52px; font-size: 1.25rem; }

.post-body { display: block; color: inherit; }
.card-content {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.65;
}
.post-body:hover .card-content { color: var(--accent-ink); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
        color 0.16s var(--ease);
}
.tag:hover { background: var(--accent-wash); border-color: rgba(176, 57, 43, 0.22); color: var(--accent-ink); }

.post-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}
.post-images.single { grid-template-columns: 1fr; max-width: 66%; }

.thumb-link {
    display: block;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.thumb-link img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-images.single .thumb-link { aspect-ratio: auto; }
.post-images.single img { max-height: 380px; }

.card-foot {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 12px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
}

/* 卡片底部的行内动作：同一形状、同一尺寸、同一焦点态 */
.btn-like,
.btn-comment,
.btn-report,
.btn-delete,
.btn-reply {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-3);
    font-family: inherit;
    font-size: var(--fs-ui);
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn-like:hover,
.btn-comment:hover,
.btn-reply:hover { background: var(--surface-2); color: var(--ink); }

.btn-like.active { color: var(--accent); }
.btn-like.active .like-count { font-weight: 600; }

.btn-like.loading { opacity: 0.55; cursor: progress; }

.btn-like .like-icon-on { display: none; }
.btn-like.active .like-icon-off { display: none; }
.btn-like.active .like-icon-on { display: inline-block; }

.like-count,
.count { font-variant-numeric: tabular-nums; }

.btn-report { margin-left: auto; }
.btn-report:hover,
.btn-delete:hover { background: var(--bad-wash); color: var(--bad); }

.btn-comment.muted { color: var(--ink-3); cursor: default; }
.btn-comment.muted:hover { background: none; }

/* 唯一的编排式动效：点赞时印章落下的回弹 */
@keyframes seal-pop {
    0%   { transform: scale(1); }
    38%  { transform: scale(1.3); }
    68%  { transform: scale(0.94); }
    100% { transform: scale(1); }
}
.btn-like.just-liked .like-icon-on {
    animation: seal-pop 320ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

/* ---------- 详情页 ---------- */
.detail-card { padding: 20px; }
.detail-content {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: var(--fs-lg);
    line-height: 1.7;
}
.detail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.like-text { color: var(--ink-3); font-size: var(--fs-sm); }

/* 详情页的点赞是一个实体按钮，与旁边的举报动作形成主次层级 */
.detail-actions .btn-like {
    padding: 6px 12px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    font-size: var(--fs-body);
}
.detail-actions .btn-like:hover { background: var(--surface-2); }
.detail-actions .btn-like.active {
    border-color: rgba(176, 57, 43, 0.32);
    background: var(--accent-wash);
}
.detail-actions .like-text { color: inherit; opacity: 0.8; }

/* ---------- 评论 ---------- */
.comments-card { padding: 18px 16px; }

.comment-form { margin-bottom: 16px; }
.comment-form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 9px;
}

.comment-item {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}
.comment-item:last-child { padding-bottom: 0; }

.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-name { font-size: var(--fs-ui); font-weight: 600; }
.comment-content { white-space: pre-wrap; word-break: break-word; font-size: var(--fs-ui); }
.comment-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; }

/* 回复列表：1px 细线 + 底纹，不使用粗色条 */
.reply-list {
    margin: 8px 0 0 4px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
}
.reply-item { padding: 8px 0; }
.reply-item + .reply-item { border-top: 1px solid var(--line); }
.reply-to { color: var(--accent); font-size: var(--fs-sm); }

.reply-form {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.reply-form.open { display: block; }
.reply-form .input { background: var(--surface); }

.comment-empty,
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 40px 16px;
    color: var(--ink-3);
    text-align: center;
}
.empty-icon { color: var(--line-2); margin-bottom: 2px; }
.empty-title { color: var(--ink-2); font-size: var(--fs-body); font-weight: 600; }
.empty-hint { font-size: var(--fs-sm); max-width: 34ch; }
.empty-action { margin-top: 10px; }
.comment-empty { padding: 26px 16px; }

/* ---------- 个人中心 ---------- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.profile-name { font-size: var(--fs-xl); }
.profile-meta { color: var(--ink-3); font-size: var(--fs-sm); }

.comment-card { padding: 14px 16px; }
.comment-card .comment-head { justify-content: space-between; margin-bottom: 4px; }
.comment-on { margin-top: 6px; color: var(--ink-3); font-size: var(--fs-sm); }
.comment-on a { word-break: break-all; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    line-height: 1.7;
    white-space: nowrap;
}
.badge-ok { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok); }
.badge-warn { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.badge-danger { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad); }
.badge-muted { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.badge-admin { background: var(--info-wash); border-color: var(--info-line); color: var(--info); }
.badge-status { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 20px 0 8px;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-2);
    font-size: var(--fs-ui);
    font-variant-numeric: tabular-nums;
    transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
        color 0.16s var(--ease);
}
.page-link:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.page-link.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* 分页省略号与「共 N 条」计数 */
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    color: var(--ink-3);
    font-size: var(--fs-ui);
    user-select: none;
}
.pagination-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 10px;
    color: var(--ink-3);
    font-size: var(--fs-ui);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- 举报对话框（原生 dialog：可逃逸容器、自带焦点陷阱） ---------- */
.report-dialog {
    /* 全局 * { margin: 0 } 重置会覆盖浏览器给 dialog 的 margin: auto，
       这里显式补回，否则模态框会贴在视口左上角 */
    margin: auto;
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-2);
}
.report-dialog::backdrop { background: rgba(32, 29, 26, 0.42); }
.dialog-body { padding: 18px; }
.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.dialog-title { font-size: var(--fs-lg); }
.dialog-close {
    display: inline-flex;
    padding: 4px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-3);
    cursor: pointer;
}
.dialog-close:hover { background: var(--surface-2); color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog-body .field { margin-bottom: 0; }

/* ---------- 页脚 ---------- */
.footer {
    margin-top: 28px;
    padding: 18px 0 28px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: var(--fs-sm);
    text-align: center;
}
body.admin .footer { border-top-color: var(--line-2); }

/* ---------- 管理后台 ---------- */
.page-title { font-size: var(--fs-xl); margin-bottom: 16px; }

/* 统计条：单一面板 + 1px 分隔线，数值体量克制且不着色 */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin-bottom: 16px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.stat-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 12px 14px;
    background: var(--surface);
    color: inherit;
    transition: background-color 0.16s var(--ease);
}
a.stat-item:hover { background: var(--surface-2); }
.stat-value {
    font-size: var(--fs-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.5; }

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}
.table-wrap::-webkit-scrollbar-thumb { border-color: var(--surface); }

.admin-table {
    width: 100%;
    min-width: 740px;
    border-collapse: collapse;
    font-size: var(--fs-ui);
}
.admin-table th {
    position: sticky;
    top: 0;
    padding: 9px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    /* 单元格不换行，避免中文姓名、标签、时间被逐字拆行；超宽由 .table-wrap 横向滚动 */
    white-space: nowrap;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--surface-2); }
.admin-table .badge { vertical-align: middle; }

.col-ellipsis {
    max-width: 20ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 空状态单元格需要恢复自动换行 */
.admin-table td.empty { white-space: normal; }
.actions-cell { white-space: nowrap; }
.actions-cell .inline-form { display: inline-flex; gap: 6px; }
.actions-cell .btn + .btn { margin-left: 6px; }

/* 操作列吸附在表格右侧：列多（如加了「热度」）需要横向滚动时，
   按钮始终可见可点，不会被挤出卡片边缘。左侧用一道柔和阴影表明
   「浮在滚动内容之上」，避免看起来像把前一列切断了；
   分隔线用 inset 阴影而非 border，因为 border-collapse 下
   sticky 单元格的 border 会跟着内容滚走。 */
.admin-table th:last-child,
.admin-table td.actions-cell,
.admin-table td.col-pin {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--surface);
    box-shadow: inset 1px 0 0 var(--line), -10px 0 12px -10px rgba(32, 29, 26, 0.18);
}
.admin-table th:last-child {
    background: var(--surface-2);
    z-index: 2;
}
.admin-table tbody tr:hover td.actions-cell,
.admin-table tbody tr:hover td.col-pin { background: var(--surface-2); }

/* 举报条目 */
.report-item { padding: 14px 0; border-top: 1px solid var(--line); }
.report-item:first-of-type { border-top: none; padding-top: 4px; }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-info,
.report-target { margin-top: 5px; color: var(--ink-3); font-size: var(--fs-sm); }
.report-reason { margin-top: 5px; font-size: var(--fs-ui); }
.report-target .quote { color: var(--ink); }
.report-actions { display: flex; gap: 8px; margin-top: 10px; }

/* 敏感词 */
.word-add-form { display: flex; gap: 8px; }
.word-add-form .input { flex: 1; min-width: 0; }
.word-list { display: flex; flex-wrap: wrap; gap: 8px; }
.word-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
}
.word-text { font-size: var(--fs-ui); }

/* 后台内的空状态面板保持紧凑；表格单元格必须保留 table-cell 布局 */
.admin-table .empty {
    display: block;
    padding: 26px 16px;
    text-align: center;
}

/* ---------- 推荐调试 ---------- */
.reco-user-select { max-width: 320px; }
.reco-profile .profile-head { margin-bottom: 12px; }
.reco-profile .avatar { width: 44px; height: 44px; font-size: 1.0625rem; }
.reco-stats { margin: 0 0 12px; }
.reco-rebuild-form { margin-top: 12px; }
.reco-note { text-align: left; }
.reco-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reco-tags .field-label { width: 100%; margin-bottom: 4px; }
.reco-tags .tag { background: var(--surface-2); }
.reco-tags .tag-hot {
    background: var(--accent-wash);
    border-color: rgba(176, 57, 43, 0.22);
    color: var(--accent-ink);
}
.reco-table .col-ellipsis { max-width: 18ch; }

/* 分数构成条：四段从左到右为 内容/协同/热度/随机（数据可视化，非装饰） */
.comp-bar {
    display: flex;
    width: 100%;
    min-width: 90px;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-2);
}
.comp-bar span { display: block; height: 100%; }
.comp-c { background: #b0392b; }   /* 内容 - 朱砂 */
.comp-l { background: #5a6cf0; }   /* 协同 - 靛蓝 */
.comp-h { background: #d89a2b; }   /* 热度 - 琥珀 */
.comp-r { background: #8c9aac; }   /* 随机 - 灰蓝 */
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin: 0 4px 0 10px;
    vertical-align: -1px;
}
.reco-legend .field-hint { line-height: 2; }

/* ---------- 响应式：结构性变化，而非字号缩放 ---------- */
@media (min-width: 768px) {
    .container { padding: 0 24px; }
    body.admin .container { max-width: 980px; }
    main.container { padding-top: 26px; }
    .stat-strip { grid-template-columns: repeat(5, 1fr); }
    /* 推荐调试页只有 4 项统计，避免第 5 格留白 */
    .reco-stats { grid-template-columns: repeat(4, 1fr); }
}

/* 后台模块较多：窄屏下把导航单独放一行，成为可横向滚动的模块条，
   避免 6 个模块被静默截断、用户不知道后面还有内容 */
@media (max-width: 767px) {
    body.admin .topbar-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 9px 0;
        row-gap: 7px;
    }
    body.admin .nav { order: 3; flex: 0 0 100%; }
    body.admin .user-area { margin-left: auto; }
}

/* ---------- 无障碍：尊重减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
