/* ==========================================================================
   页面级样式：帖子详情 / 个人主页 / 关注收藏 / 消息 / 设置 / 管理 / 搜索
   ========================================================================== */

/* ── 帖子详情 ─────────────────────────────────── */
.nz-post-head-card { display: flex; flex-direction: column; gap: 12px; }
.nz-post-title-lg {
    font-size: clamp(21px, 3.4vw, 28px);
    font-weight: 800;
    line-height: 1.35;
    color: var(--nz-text-strong);
    letter-spacing: -.01em;
}
.nz-post-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nz-post-meta-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nz-post-meta-name { font-weight: 700; color: var(--nz-text-strong); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nz-post-meta-sub { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); display: flex; gap: 8px; flex-wrap: wrap; }
.nz-post-body { padding: 0; }

.nz-render-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px dashed var(--nz-border);
    margin-bottom: 14px;
}
.nz-risk-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: var(--nz-radius-pill);
    background: var(--nz-warning-soft);
    color: var(--nz-warning);
    font-size: var(--nz-fs-xs);
    font-weight: 700;
}
/* 底部只放四个高频操作，中间用一条线隔开 */
.nz-post-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--nz-border);
    margin-top: 18px;
}
.nz-post-actions .nz-action {
    font-size: var(--nz-fs-base);
    padding: 8px 14px;
    border-radius: var(--nz-radius-pill);
    transition: color var(--nz-dur) var(--nz-ease), background var(--nz-dur) var(--nz-ease);
}
.nz-post-actions .nz-action:hover { background: var(--nz-surface-3); }
/* 选中：图标变实心 + 变色，跟大多数论坛一样 */
.nz-post-actions .nz-action.is-on .nz-icon { fill: currentColor; }
.nz-post-actions .nz-action.is-like.is-on { color: var(--nz-danger); background: var(--nz-danger-soft); }
.nz-post-actions .nz-action.is-fav.is-on { color: var(--nz-accent-deep); background: var(--nz-accent-soft); }

/* ── 正文下面：自定义脚本提示（脚本一律不自动注入）───────── */
.nz-script-notice {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--nz-radius-sm);
    border: 1px solid color-mix(in srgb, var(--nz-warning) 35%, transparent);
    background: var(--nz-warning-soft);
}
.nz-script-notice:empty { display: none; }
.nz-script-notice-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--nz-fs-sm);
    font-weight: 700;
    color: var(--nz-warning);
}
.nz-script-notice-head .nz-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.nz-script-toggle { align-self: flex-start; }
.nz-script-toggle .nz-icon { transition: transform var(--nz-dur) var(--nz-ease); }
.nz-script-toggle.is-open .nz-icon { transform: rotate(180deg); }
/* hidden 属性会被上面的 display:flex 顶掉（跟 .nz-expand-btn 同一个坑） */
.nz-script-list { display: flex; flex-direction: column; gap: 10px; }
.nz-script-list[hidden] { display: none; }
.nz-script-item {
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-sm);
    background: var(--nz-surface-2);
    overflow: hidden;
}
.nz-script-item-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: var(--nz-fs-xs);
    color: var(--nz-text-sub);
    background: var(--nz-surface-3);
}
.nz-script-item-head .nz-icon { width: 14px; height: 14px; }
/* 脚本原样摊开，不做内部滚动条：太长时底部会出现常驻的"收起" */
.nz-script-code {
    margin: 0;
    padding: 10px 12px;
    overflow-x: auto;
    font-family: var(--nz-font-mono);
    font-size: var(--nz-fs-xs);
    line-height: 1.6;
    white-space: pre;
    color: var(--nz-text);
}

/* 右上角的三点菜单 */
.nz-post-more { position: relative; margin-left: auto; flex: 0 0 auto; order: 9; }
.nz-post-meta-right { order: 10; margin-left: 0 !important; flex: 1 1 100%; }
.nz-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 176px;
    padding: 6px;
    background: var(--nz-surface);
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-sm);
    box-shadow: var(--nz-shadow-modal);
    /* 45 比底栏(70)和顶栏(60)都低，菜单一长就被底栏盖住下半截；
       高度也不设限，屏幕矮的时候最后几项直接掉到视口外面（"显示不全"） */
    z-index: 75;
    max-height: min(62vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: nz-pop var(--nz-dur) var(--nz-ease-out) both;
}
/* 下面放不下就往上弹（post.js 在打开的时候量一次，够不够由它决定） */
.nz-menu.is-up {
    top: auto;
    bottom: calc(100% + 6px);
}
.nz-menu[hidden] { display: none; }
.nz-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    background: none;
    border-radius: var(--nz-radius-xs);
    font: inherit;
    font-size: var(--nz-fs-sm);
    font-weight: 600;
    color: var(--nz-text);
    text-align: left;
    cursor: pointer;
    transition: background var(--nz-dur-fast) var(--nz-ease), color var(--nz-dur-fast) var(--nz-ease);
}
.nz-menu-item:hover { background: var(--nz-surface-3); color: var(--nz-text-strong); }
.nz-menu-item.is-danger { color: var(--nz-danger); }
.nz-menu-item.is-danger:hover { background: var(--nz-danger-soft); }
.nz-menu-sep { height: 1px; background: var(--nz-border-soft); margin: 5px 6px; }
@media (max-width: 640px) {
    .nz-post-actions { gap: 2px; }
    .nz-post-actions .nz-action { padding: 8px 10px; font-size: var(--nz-fs-sm); }
}
.nz-neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nz-neighbor {
    padding: 11px 14px;
    border-radius: var(--nz-radius-sm);
    border: 1px solid var(--nz-border);
    background: var(--nz-surface);
    font-size: var(--nz-fs-sm);
    cursor: pointer;
    transition: all var(--nz-dur) var(--nz-ease);
    min-width: 0;
}
.nz-neighbor:hover { border-color: var(--nz-accent); }
.nz-neighbor-label { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); }
@media (max-width: 640px) { .nz-neighbors { grid-template-columns: 1fr; } }

/* ── 分区页头 ─────────────────────────────────── */
.nz-section-hero {
    position: relative;
    border-radius: var(--nz-radius-lg);
    overflow: hidden;
    padding: 20px;
    background: var(--nz-surface-2);
    border: 1px solid var(--nz-border);
}
.nz-section-hero.has-cover { min-height: 150px; display: flex; align-items: flex-end; }
.nz-section-hero.has-cover img.nz-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nz-section-hero.has-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,40,60,.1), rgba(20,40,60,.6)); }
.nz-section-hero-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; }
.nz-section-hero.has-cover .nz-section-hero-body { color: #fff; }
.nz-section-hero.has-cover .nz-page-title { color: #fff; }
.nz-section-hero.has-cover .nz-page-sub { color: rgba(255,255,255,.85); }

/* ── 个人主页 ─────────────────────────────────── */
.nz-profile-cover {
    position: relative;
    height: 190px;
    border-radius: var(--nz-radius-lg);
    overflow: hidden;
    background: var(--nz-surface-invert);
    border: 1px solid var(--nz-border);
}
.nz-profile-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nz-profile-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(10,25,40,.55)); }
.nz-profile-cover-actions { position: absolute; right: 12px; top: 12px; z-index: 2; display: flex; gap: 8px; }

.nz-profile-bar {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-top: -44px;
    padding: 0 20px;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
}
.nz-profile-bar .nz-avatar-xl {
    border: 4px solid var(--nz-surface);
    box-shadow: var(--nz-shadow-sm);
    background: var(--nz-surface);
}
.nz-profile-id {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 50px 0 4px;
    min-width: 0;
    /* flex-basis 必须是 0，不能是 auto：
       这一行是 flex-wrap 的，算"要不要换行"用的是 flex-basis。
       auto 会取名字的 max-content（超长昵称 = 很宽），于是右侧那排按钮被判定
       "这一行放不下"整个掉到下一行，还带着 50px 的 padding-top，
       看起来就是按钮被顶到一个莫名其妙的位置。basis 给 0 之后，
       名字的宽度由 .nz-scroll-x 自己横滑消化，按钮稳稳留在原地 */
    flex: 1 1 0;
}
/* 名字套在 .nz-scroll-x 里自己横滑，这里只负责"名字 + 角色徽章"这一行 */
.nz-profile-name { font-size: var(--nz-fs-2xl); font-weight: 800; color: var(--nz-text-strong); display: flex; align-items: center; gap: 8px; min-width: 0; }
/* 名字不 grow：短名字要贴着角色徽章，多出来的空间留在右边。
   只在放不下的时候 shrink，那时候由 .nz-scroll-x 自己横滑消化 */
.nz-profile-name > * { flex: 0 0 auto; }
.nz-profile-name > .nz-scroll-x { flex: 0 1 auto; }
.nz-profile-handle { color: var(--nz-text-faint); font-size: var(--nz-fs-sm); }
.nz-profile-bio { color: var(--nz-text-sub); font-size: var(--nz-fs-md); line-height: 1.7; padding: 12px 20px 0; white-space: pre-wrap; word-break: break-word; }
.nz-profile-actions { display: flex; gap: 8px; align-items: center; padding: 12px 20px 0; flex-wrap: wrap; }
.nz-profile-stats { padding: 14px 20px 0; gap: 10px; }
.nz-profile-stats .nz-stat {
    min-width: 84px;
    padding: 7px 14px;
    border-radius: var(--nz-radius-sm);
    background: var(--nz-surface-2);
    border: 1px solid var(--nz-border);
    transition: background var(--nz-dur) var(--nz-ease), border-color var(--nz-dur) var(--nz-ease), transform var(--nz-dur) var(--nz-ease);
}
a.nz-profile-stats .nz-stat:hover, a.nz-stat:hover { transform: translateY(-1px); }
a.nz-stat:hover { background: var(--nz-accent-soft); border-color: color-mix(in srgb, var(--nz-accent) 34%, transparent); }
.nz-profile-stats .nz-stat-num { font-size: var(--nz-fs-lg); }
.nz-profile-links { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 20px 0; }

@media (max-width: 640px) {
    .nz-profile-cover { height: 132px; border-radius: var(--nz-radius-md); }
    .nz-profile-bar { margin-top: -34px; padding: 0 14px; gap: 12px; }
    /* 只写 width 不够，.nz-avatar-xl 的 min-width 会赢，头像就被拉成横向的椭圆 */
    .nz-profile-bar .nz-avatar-xl { width: 68px; height: 68px; min-width: 68px; border-width: 3px; }
    .nz-profile-id { padding-top: 38px; }
    .nz-profile-bar .nz-row { padding-top: 38px !important; }
    .nz-profile-stats .nz-stat { min-width: 68px; padding: 6px 10px; }
    .nz-profile-name { font-size: var(--nz-fs-xl); }
    /* 手机上"头像 + 名字 + 一排按钮"根本挤不进一行：390px 的屏幕里名字只剩下 24px，
       "柠喵酱"会被截成"柠"。所以这里让按钮整排落到第二行，
       同时把 38px 那个内边距换成 12px —— 那个内边距是为了"按钮和名字齐平"，
       一旦换行它就变成一大块空白，看着就像按钮被顶到了莫名其妙的位置 */
    .nz-profile-bar > .nz-row { flex: 1 0 100%; padding-top: 12px !important; justify-content: flex-start; }
    .nz-profile-bio, .nz-profile-actions, .nz-profile-stats, .nz-profile-links { padding-left: 14px; padding-right: 14px; }
}

/* 活跃度热力图 */
/* 近 12 周活跃度：方块水平铺满，横竖间距一致，高度跟着宽度自适应 */
.nz-heatmap {
    /* 老老实实写死 12 列。用 grid-auto-flow: column + 1fr 的时候
       浏览器算出来的列宽是错的（方块会叠在一起），别跟它绕 */
    display: grid;
    grid-template-columns: repeat(20, minmax(0, 1fr));   /* 20 列 × 5 行 = 近 100 天 */
    gap: 3px;
    width: 100%;
}
.nz-heatmap > * {
    width: 100%;
    aspect-ratio: 1 / 1;   /* 方块，高度自己跟着列宽走 */
    border-radius: 3px;
    display: block;
}
.nz-heat-cell { background: var(--nz-surface-3); }
.nz-heat-1 { background: color-mix(in srgb, var(--nz-accent) 28%, var(--nz-surface-3)); }
.nz-heat-2 { background: color-mix(in srgb, var(--nz-accent) 52%, var(--nz-surface-3)); }
.nz-heat-3 { background: color-mix(in srgb, var(--nz-accent) 76%, var(--nz-surface-3)); }
.nz-heat-4 { background: var(--nz-accent-deep); }

/* ── 收藏夹 ───────────────────────────────────── */
.nz-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.nz-folder {
    display: flex; align-items: center; gap: 10px;
    padding: 14px;
    border-radius: var(--nz-radius-md);
    border: 1px solid var(--nz-border);
    background: var(--nz-surface);
    cursor: pointer;
    transition: all var(--nz-dur) var(--nz-ease);
}
.nz-folder:hover { border-color: var(--nz-accent); transform: translateY(-2px); box-shadow: var(--nz-shadow-sm); }
.nz-folder.is-active { border-color: var(--nz-accent); background: var(--nz-accent-soft); }
.nz-folder-icon {
    width: 40px; height: 40px; border-radius: var(--nz-radius-sm);
    background: var(--nz-accent-soft); color: var(--nz-accent-deep);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.nz-folder-name { font-weight: 700; color: var(--nz-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nz-folder-meta { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); }

/* ── 消息中心 ─────────────────────────────────── */
.nz-msg-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.nz-msg-nav { display: flex; flex-direction: column; gap: 3px; }

/* 窄屏：改成上下两段，导航横过来当胶囊，否则右边会被挤成一列字 */
@media (max-width: 860px) {
    .nz-msg-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .nz-msg-nav {
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .nz-msg-nav::-webkit-scrollbar { display: none; }
    .nz-msg-nav .nz-nav-item { flex: 0 0 auto; padding: 8px 12px; }
    .nz-msg-nav .nz-nav-label { flex: 0 0 auto; }
    .nz-msg-nav .nz-nav-item.is-active::before { display: none; }
}
.nz-msg-item {
    display: flex; gap: 11px;
    padding: 12px;
    border-radius: var(--nz-radius-sm);
    border: 1px solid transparent;
    transition: background var(--nz-dur) var(--nz-ease);
    cursor: pointer;
}
.nz-msg-item:hover { background: var(--nz-surface-2); }
.nz-msg-item.is-unread { background: var(--nz-accent-soft); }
.nz-msg-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nz-msg-line { font-size: var(--nz-fs-base); color: var(--nz-text); line-height: 1.6; word-break: break-word; }
.nz-msg-line b { color: var(--nz-text-strong); }
.nz-msg-sub { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); }
.nz-msg-quote {
    font-size: var(--nz-fs-sm);
    color: var(--nz-text-sub);
    background: var(--nz-surface-3);
    border-radius: var(--nz-radius-xs);
    padding: 7px 10px;
    margin-top: 4px;
    -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 私信 ─────────────────────────────────────── */
.nz-dm-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    /* 行高必须被容器约束住，否则消息一多整行会被内容撑高，
       发送栏就被挤到容器外面，点都点不到 */
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    height: calc(100vh - var(--nz-header-h) - 60px);
    min-height: 460px;
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-md);
    overflow: hidden;
    background: var(--nz-surface);
}
.nz-dm-threads { border-right: 1px solid var(--nz-border); overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.nz-dm-thread {
    display: flex; gap: 10px;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--nz-border-soft);
    transition: background var(--nz-dur) var(--nz-ease);
    min-width: 0;
}
.nz-dm-thread:hover { background: var(--nz-surface-2); }
.nz-dm-thread.is-active { background: var(--nz-accent-soft); }
.nz-dm-thread-name { font-weight: 700; color: var(--nz-text-strong); font-size: var(--nz-fs-base); min-width: 0; flex: 0 1 auto; }
.nz-dm-thread-last { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nz-dm-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nz-dm-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--nz-border); flex: 0 0 auto; }
.nz-dm-box { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--nz-surface-2); }
/* 一行消息 = 头像 + 气泡，自己的靠右 */
.nz-dm-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.nz-dm-row.is-me { flex-direction: row-reverse; }
.nz-dm-row .nz-avatar { flex: 0 0 auto; }
.nz-dm-row .nz-dm-bubble { min-width: 0; }

.nz-dm-bubble {
    max-width: min(72%, 520px);
    padding: 9px 13px;
    border-radius: var(--nz-radius-md);
    background: var(--nz-surface);
    border: 1px solid var(--nz-border);
    font-size: var(--nz-fs-base);
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
    align-self: flex-start;
    box-shadow: var(--nz-shadow-xs);
}
.nz-dm-bubble.is-me { background: var(--nz-accent); border-color: transparent; color: #fff; }
.nz-dm-bubble .dm-time { opacity: .65; margin-top: 4px; }
.nz-dm-bubble.is-me .dm-time { color: rgba(255,255,255,.85); }
.nz-dm-bubble img { border-radius: var(--nz-radius-xs); max-width: 100%; display: block; }
.nz-dm-time { font-size: 11px; color: var(--nz-text-faint); align-self: center; }
.nz-dm-composer { border-top: 1px solid var(--nz-border); padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; background: var(--nz-surface); }
.nz-dm-composer textarea { min-height: 62px; max-height: 160px; }
/* 私信页在电脑上也不显示那行大标题，不然整块会被顶出屏幕 */
body.is-dm .nz-page-head { display: none; }
body.is-dm .nz-dm-layout { height: calc(100vh - var(--nz-header-h) - 36px); }
@media (min-width: 821px) {
    body.is-dm .nz-body { padding-bottom: 18px; }
}

.nz-dm-preview { position: relative; width: 120px; }
.nz-dm-preview img { width: 100%; display: block; border-radius: var(--nz-radius-xs); }
/* 取消这张图的叉：压在预览图右上角内侧（原来是 -8px 悬在图片外面，
   手机上手指够不到，加上位置落在父容器外面，看着像"点了没反应"） */
.nz-dm-preview button { position: absolute; top: 3px; right: 3px; z-index: 2; width: 26px; height: 26px; padding: 0; }

/* 消息里的图片：点开是全屏预览 */
/* 注意：这里不能再写 max-width: min(320px, 62vw) —— 它优先级比 .nz-dm-bubble img 的
   max-width:100% 高，会把"不许超过气泡内容宽度"这条顶掉，比 1:1 宽的图就顶出气泡右边框了。
   宽度交给基类限制，这里只管高度和圆角。 */
.nz-dm-bubble .nz-dm-img { max-width: 100%; max-height: 320px; cursor: zoom-in; background: var(--nz-surface-3); }
.nz-dm-preview-meta {
    position: absolute; left: 6px; bottom: 6px;
    padding: 2px 7px;
    border-radius: var(--nz-radius-pill);
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: var(--nz-fs-xs);
}
.nz-dm-preview-status { padding: 6px 10px; font-size: var(--nz-fs-sm); color: var(--nz-text-sub); }

/* 撤回的那一条：居中一行灰字，没有头像也没有气泡 */
.nz-dm-row.is-recall { justify-content: center; }
.nz-dm-recall {
    margin: 2px auto;
    padding: 3px 10px;
    border-radius: var(--nz-radius-pill);
    background: var(--nz-surface-3);
    color: var(--nz-text-faint);
    font-size: var(--nz-fs-xs);
}

/* 发送状态位：转圈 = 发送中，感叹号 = 发失败了（点一下重发）。
   is-me 那行是 row-reverse，所以这颗天然落在气泡左边（靠屏幕外侧那一侧） */
.nz-dm-state {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    color: var(--nz-text-faint);
}
.nz-dm-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--nz-border);
    border-top-color: var(--nz-accent);
    border-radius: 50%;
    animation: nz-spin .9s linear infinite;
}
.nz-dm-state.is-failed { color: var(--nz-danger); cursor: pointer; }
.nz-dm-state.is-failed .nz-icon { width: 20px; height: 20px; }
.nz-dm-row.is-pending .nz-dm-bubble { opacity: .85; }
.nz-dm-row.is-failed .nz-dm-bubble { opacity: .6; }

/* 长按 / 右键消息出来的小菜单（撤回 / 删除） */
.nz-msg-menu {
    position: fixed;
    z-index: 340;
    min-width: 132px;
    padding: 6px;
    background: var(--nz-surface);
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-sm);
    box-shadow: var(--nz-shadow-modal);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: nz-pop var(--nz-dur) var(--nz-ease-out) both;
}

/* ── 全屏图片预览 ─────────────────────────────── */
.nz-iv {
    position: fixed;
    inset: 0;
    z-index: 320;
    background: rgba(6, 10, 16, .93);
    opacity: 0;
    transition: opacity .2s var(--nz-ease);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
.nz-iv.is-open { opacity: 1; }
.nz-iv-stage { position: absolute; inset: 0; display: grid; place-items: center; cursor: grab; }
.nz-iv-stage:active { cursor: grabbing; }
/* 翻页的横移挂在这一层：缩放 / 拖动还是 img 自己的 transform，两套位移不打架。
   这一层里只有当前这一张图 —— 不摆左右邻居（露出来的是黑底），
   这样不会两张黏在一起，放大时也不会出现邻居位置对不上的穿帮 */
.nz-iv-track { position: relative; display: grid; place-items: center; will-change: transform; }
/* 手指跟手期间把 CSS 那点 opacity 过渡掐掉，不然下拉淡出会慢半拍 */
.nz-iv.is-dragging { transition: none; }
.nz-iv-img {
    /* 尺寸由 JS 算（imageViewer.js 的 resetView）：规则是"最长的那条边顶到屏幕边界"，
       横图宽顶满、竖图高顶满。这里的值是 JS 跑之前的兜底，先按 contain 摆着，
       免得图片先按某一边撑开、JS 接手时又跳一下 */
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
    will-change: transform;
    -webkit-user-drag: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
/* 第几张 / 共几张 */
.nz-iv-counter {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: var(--nz-radius-pill);
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: var(--nz-fs-sm);
    font-weight: 600;
    pointer-events: none;
}
.nz-iv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--nz-radius-pill);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font: inherit;
    font-size: var(--nz-fs-sm);
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(6px);
}
.nz-iv-btn:hover { background: rgba(255, 255, 255, .24); }
.nz-iv-btn:disabled { opacity: .65; cursor: default; }
.nz-iv-close { position: absolute; top: 14px; right: 14px; z-index: 3; }
.nz-iv-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}
.nz-iv-foot > * { pointer-events: auto; }
.nz-iv-foot-mid { flex: 1 1 auto; display: flex; justify-content: center; }
.nz-iv-mini {
    position: relative;
    width: 132px;
    height: 92px;
    border-radius: var(--nz-radius-xs);
    border: 1px solid rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
    cursor: crosshair;
    flex: 0 0 auto;
}
.nz-iv-mini[hidden] { display: none; }
.nz-iv-mini img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nz-iv-mini-view {
    position: absolute;
    border: 1.5px solid #fff;
    border-radius: 2px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .38);
    pointer-events: none;
}
.nz-iv-note { color: rgba(255, 255, 255, .72); font-size: var(--nz-fs-sm); }
.nz-iv-progress {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    width: min(320px, 76vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: var(--nz-fs-sm);
}
.nz-iv-progress[hidden] { display: none; }
.nz-iv-progress-track { width: 100%; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.nz-iv-progress-bar { height: 100%; width: 0; background: var(--nz-accent); transition: width .15s linear; }



/* ── 搜索页：手机上整屏（跟私信会话一个路子）────── */
.nz-search-page { display: flex; flex-direction: column; gap: 12px; }
.nz-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--nz-radius-md);
    background: var(--nz-surface);
    border: 1px solid var(--nz-border);
}
.nz-search-bar .nz-input { height: 42px; border-radius: var(--nz-radius-pill); }
.nz-search-result { min-height: 0; }

/* ── 搜索历史 ─────────────────────────────────── */
.nz-search-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--nz-radius-md);
    background: var(--nz-surface);
    border: 1px solid var(--nz-border);
}
.nz-search-history-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: var(--nz-fs-sm);
    font-weight: 700;
    color: var(--nz-text-strong);
}
.nz-history-tags {
    --nz-hh-line: 26px;
    --nz-hh-gap: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--nz-hh-gap);
}
/* 没展开：最多露 3 行，多出来的直接裁掉 */
.nz-history-tags.is-clip {
    max-height: calc(var(--nz-hh-line) * 3 + var(--nz-hh-gap) * 2);
    overflow: hidden;
}
.nz-history-tag {
    max-width: 100%;
    min-height: var(--nz-hh-line);
}
/* 单条最长就这么宽：再长交给里面的 .nz-scroll-x 横滑 + 两头渐隐
   （和个人主页那些超长昵称同一套，见 core/scrollX.js） */
.nz-history-tag > .nz-scroll-x { max-width: 220px; }
/* 底部那道渐隐：压在被裁掉的地方，暗示"下面还有" */
.nz-history-fade {
    height: 28px;
    margin-top: -28px;
    background: linear-gradient(to bottom, transparent, var(--nz-surface));
    pointer-events: none;
}
.nz-history-fade[hidden] { display: none; }

@media (max-width: 820px) {
    /* 进搜索页就整屏：顶栏、底栏、页面标题栏全让位，搜索栏钉在顶上，结果自己滚 */
    body.is-search .nz-header,
    body.is-search .nz-bottombar,
    body.is-search #nz-hero,
    body.is-search .nz-page-head { display: none; }
    body.is-search .nz-body {
        padding: 0;
        gap: 0;
        height: 100dvh;
        overflow: hidden;
    }
    body.is-search .nz-main { overflow: hidden; }
    .nz-search-page { height: 100dvh; gap: 0; }
    .nz-search-bar {
        flex: 0 0 auto;
        border: 0;
        border-bottom: 1px solid var(--nz-border);
        border-radius: 0;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    }
    .nz-search-page > .nz-seg { margin: 10px 12px 0; flex: 0 0 auto; }
    /* 历史区：整屏布局里它是"能缩"的那一块，展开全部时自己也滚，
       最多占 46% 屏高，别把结果区挤没 */
    .nz-search-page > .nz-search-history {
        margin: 10px 12px 0;
        flex: 0 1 auto;
        max-height: 46dvh;
        overflow-y: auto;
    }
    .nz-search-result {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    }
    body.is-search .nz-search-result .nz-post { margin-bottom: 10px; }
}

/* 手机端私信是一个独立整屏页面：顶栏底栏都让位，输入框永远在屏幕里 */
@media (max-width: 820px) {
    .nz-dm-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr);
        height: calc(100dvh - var(--nz-header-h) - var(--nz-bottombar-h) - 40px);
        border-radius: var(--nz-radius-md);
    }
    .nz-dm-threads { border-right: 0; min-height: 0; }
    .nz-dm-chat { min-height: 0; }
    .nz-dm-box { min-height: 0; }
    .nz-dm-layout.is-chat .nz-dm-threads { display: none; }
    .nz-dm-layout:not(.is-chat) .nz-dm-chat { display: none; }

    /* 进了私信会话就整屏：顶栏、底栏、页面标题栏全都让位，布局撑满 dvh */
    body.is-dm .nz-header,
    body.is-dm .nz-bottombar,
    body.is-dm #nz-hero { display: none; }
    body.is-dm .nz-body {
        padding: 0;
        gap: 0;
        height: 100dvh;
        overflow: hidden;      /* 整页锁死，只有消息区能滚 */
    }
    body.is-dm .nz-main,
    body.is-dm .nz-dm-chat { overflow: hidden; }
    body.is-dm .nz-dm-layout {
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    body.is-dm .nz-dm-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
    body.is-dm .nz-dm-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

/* ── 设置页 ───────────────────────────────────── */
.nz-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--nz-border-soft);
    flex-wrap: wrap;
}
.nz-setting-row:last-child { border-bottom: 0; }
.nz-setting-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 240px; }
.nz-setting-name { font-weight: 700; color: var(--nz-text-strong); }
.nz-setting-desc { font-size: var(--nz-fs-xs); color: var(--nz-text-faint); }
.nz-skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.nz-skin {
    border-radius: var(--nz-radius-sm);
    border: 2px solid var(--nz-border);
    padding: 8px;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 7px;
    transition: all var(--nz-dur) var(--nz-ease);
    background: var(--nz-surface);
}
.nz-skin:hover { border-color: var(--nz-border-strong); }
.nz-skin.is-active { border-color: var(--nz-accent); box-shadow: 0 0 0 3px var(--nz-accent-soft); }
.nz-skin-preview { height: 46px; border-radius: var(--nz-radius-xs); position: relative; overflow: hidden; }
.nz-skin-preview::after {
    content: '';
    position: absolute; left: 8px; right: 8px; bottom: 8px; height: 10px;
    border-radius: 5px; background: rgba(255,255,255,.75);
}
.nz-skin-name { font-size: var(--nz-fs-xs); font-weight: 700; text-align: center; color: var(--nz-text-sub); }

/* ── 图标选择器（分区 / 话题编辑里点图标拉出来的那个大框） ── */
.nz-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 6px;
    max-height: 56vh;
    overflow-y: auto;
    padding: 2px;
}
.nz-icon-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-sm);
    background: var(--nz-surface);
    cursor: pointer;
    color: var(--nz-text-sub);
    font-size: 10px;
    line-height: 1.3;
}
.nz-icon-pick .nz-icon { width: 20px; height: 20px; }
.nz-icon-pick span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nz-icon-pick:hover { border-color: var(--nz-accent); color: var(--nz-accent-deep); }
.nz-icon-pick.is-active { border-color: var(--nz-accent); background: var(--nz-accent-soft); color: var(--nz-accent-deep); }
.nz-icon-btn { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-start; width: 100%; }

/* ── 话题：列表卡片 + 特殊话题 ──────────────────── */
.nz-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.nz-tagcard {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius-md);
    background: var(--nz-surface);
    overflow: hidden;
    color: inherit;
    transition: border-color var(--nz-dur) var(--nz-ease), transform var(--nz-dur) var(--nz-ease), box-shadow var(--nz-dur) var(--nz-ease);
}
.nz-tagcard:hover { border-color: var(--nz-border-strong); box-shadow: var(--nz-shadow-sm); transform: translateY(-1px); }
.nz-tagcard.is-special { border-color: color-mix(in srgb, var(--nz-accent) 42%, var(--nz-border)); }
.nz-tagcard-cover { width: 100%; height: 92px; object-fit: cover; display: block; background: var(--nz-surface-3); }
.nz-tagcard-body { padding: 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.nz-tagcard-name { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--nz-text-strong); min-width: 0; }
.nz-tagcard-name .nz-icon { color: var(--nz-accent-deep); flex: 0 0 auto; }
.nz-tagcard-flag {
    display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
    font-size: var(--nz-fs-xs); font-weight: 700;
    padding: 1px 7px; border-radius: var(--nz-radius-pill);
    background: var(--nz-accent-soft); color: var(--nz-accent-deep);
}
.nz-tagcard-desc {
    font-size: var(--nz-fs-sm); color: var(--nz-text-sub);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 设置页：黑名单管理 ─────────────────────────── */
.nz-block-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--nz-border-soft);
}
.nz-block-row:first-child { border-top: 0; }
/* 最后一行不要再留 10px 下内边距：卡片的 16px 才是这行的"下边距"，
   留着就变成 26px，看起来像是被顶到左边和上边去了 */
.nz-block-row:last-child { padding-bottom: 0; }
.nz-block-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}
.nz-block-user .nz-avatar { width: 38px; height: 38px; flex: 0 0 auto; }
/* 名字是 flex 行（名字 + 角色徽章）：text-overflow 在这一层是不生效的，
   以前超长 id 会把这一整行连同右边那个按钮一起顶出屏幕。文字交给里面的 .nz-scroll-x */
.nz-block-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-weight: 700;
    color: var(--nz-text-strong);
}
.nz-block-name > * { flex: 0 0 auto; }
.nz-block-name > .nz-scroll-x { flex: 0 1 auto; }
.nz-block-row .nz-btn { flex: 0 0 auto; }
/* 手机上"名字 + 移出黑名单"一行放不下，让按钮落到下一行靠右，
   不然它会把名字压成一条缝，或者自己被顶出屏幕 */
@media (max-width: 560px) {
    .nz-block-row { flex-wrap: wrap; row-gap: 8px; }
    .nz-block-row .nz-btn { margin-left: auto; }
}

/* ── 管理后台 ─────────────────────────────────── */
.nz-table { width: 100%; border-collapse: collapse; font-size: var(--nz-fs-sm); }
.nz-table th, .nz-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--nz-border-soft); }
.nz-table th { color: var(--nz-text-sub); font-weight: 700; font-size: var(--nz-fs-xs); background: var(--nz-surface-2); position: sticky; top: 0; z-index: 1; }
.nz-table tr:hover td { background: var(--nz-surface-2); }
.nz-table-wrap { overflow-x: auto; border: 1px solid var(--nz-border); border-radius: var(--nz-radius-md); }
@media (max-width: 720px) { .nz-table { min-width: 640px; } }

.nz-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.nz-promo-row { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--nz-border); border-radius: var(--nz-radius-md); background: var(--nz-surface); align-items: center; }
.nz-promo-row img { width: 72px; height: 52px; object-fit: cover; border-radius: var(--nz-radius-xs); flex: 0 0 auto; background: var(--nz-surface-3); }
.nz-color-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--nz-border-strong); }

/* ── 搜索 ─────────────────────────────────────── */
.nz-search-head { display: flex; gap: 10px; align-items: center; }
.nz-search-head .nz-input { height: 42px; border-radius: var(--nz-radius-pill); }

/* ── 静态信息页 ───────────────────────────────── */
.nz-article { font-size: var(--nz-fs-md); line-height: 1.85; color: var(--nz-text); }
.nz-article h2 { font-size: var(--nz-fs-xl); margin: 22px 0 10px; }
.nz-article h3 { font-size: var(--nz-fs-lg); margin: 18px 0 8px; }
.nz-article p { margin: 10px 0; }
.nz-article ul, .nz-article ol { margin: 10px 0; padding-left: 22px; list-style: disc; }
.nz-article ol { list-style: decimal; }
.nz-article li { margin: 4px 0; }
.nz-article code { font-family: var(--nz-font-mono); background: var(--nz-surface-3); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.nz-article pre { background: var(--nz-surface-3); padding: 14px; border-radius: var(--nz-radius-sm); overflow-x: auto; }
.nz-article blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--nz-accent); background: var(--nz-surface-2); border-radius: 0 var(--nz-radius-xs) var(--nz-radius-xs) 0; color: var(--nz-text-sub); }
