/* === 聊天APP 内部样式 === */

/* iOS PWA：外壳负责铺满 100vh，微信内部只负责避开可交互安全区。 */
.wechat-app-shell {
    min-height: 0;
}

.wechat-home-header {
    min-height: calc(50px + var(--content-safe-top, env(safe-area-inset-top, 0px)));
    padding-top: calc(max(24px, var(--content-safe-top-base, env(safe-area-inset-top, 0px))) + var(--device-top-offset, 0px)) !important;
    padding-bottom: 8px !important;
    box-sizing: border-box;
    flex: 0 0 auto;
    position: relative;
    z-index: 150 !important;
    overflow: visible;
    pointer-events: auto;
}

.wechat-identity-header {
    position: relative;
    z-index: 151;
    align-self: stretch;
    pointer-events: auto;
}

.wechat-identity-trigger {
    min-width: 0;
    max-width: 190px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #171717;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 152;
    pointer-events: auto !important;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.wechat-identity-trigger span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wechat-identity-trigger i {
    flex: 0 0 auto;
    font-size: 18px;
    transition: transform 160ms ease;
}

.wechat-identity-trigger[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.wechat-identity-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    z-index: 153;
    width: min(78vw, 300px);
    max-height: 310px;
    padding: 7px;
    overflow-y: auto;
    border: 1px solid rgba(17, 17, 17, 0.07);
    border-radius: 20px;
    background: rgba(250, 250, 247, 0.98);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
    transform: translateX(-50%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    pointer-events: auto;
}

.wechat-identity-option {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: #181818;
    text-align: left;
}

.wechat-identity-option:active,
.wechat-identity-option.is-selected {
    background: #efefeb;
}

.wechat-identity-option img {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 10px;
    object-fit: cover;
    background: #e8e8e4;
}

.wechat-identity-option span {
    min-width: 0;
    flex: 1;
}

.wechat-identity-option strong,
.wechat-identity-option small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wechat-identity-option strong {
    font-size: 13px;
    font-weight: 620;
}

.wechat-identity-option small {
    margin-top: 2px;
    color: #858580;
    font-size: 10px;
}

.wechat-identity-option > i {
    color: #181818;
    font-size: 16px;
    opacity: 0;
}

.wechat-identity-option.is-selected > i {
    opacity: 1;
}

.wechat-identity-menu-empty {
    padding: 18px 12px;
    color: #8c8c87;
    font-size: 12px;
    text-align: center;
}

.wechat-tab-pages {
    padding-bottom: calc(64px + var(--content-safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
    box-sizing: border-box;
}

.wechat-bottom-nav {
    height: calc(64px + var(--content-safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
    padding-bottom: calc(8px + var(--content-safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
    box-sizing: border-box;
}

/* 微信会话列表：更紧凑的软黑白排版 */
.wechat-chat-row {
    min-height: 58px;
    padding: 9px 13px !important;
    gap: 10px !important;
    border-color: rgba(17, 17, 17, 0.055) !important;
    background: #fff !important;
    transform: none !important;
}

.wechat-chat-row:active {
    background: #f5f5f2 !important;
}

.wechat-chat-list-avatar {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    border-radius: 11px !important;
    background: #ecece8 !important;
    box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.045);
}

.wechat-chat-list-body {
    margin-left: 0 !important;
}

.wechat-chat-list-name {
    color: #181818 !important;
    font-size: 14px !important;
    font-weight: 620 !important;
    letter-spacing: -0.01em;
}

.wechat-chat-list-time {
    color: #aaa9a5 !important;
    font-size: 10px !important;
    font-weight: 450;
}

.wechat-chat-list-preview {
    color: #858580 !important;
    font-size: 11.5px !important;
    line-height: 1.35;
}

/* 布局容器：撑满 APP 窗口 */
.chat-layout-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #ededed;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 修复：移除负边距，因为 global.css 已经去掉了父容器 padding */
    margin: 0;     
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.moments-fullscreen .app-header {
    display: none;
}

/* 中间舞台：自动伸缩，可滚动 */
.chat-content-stage {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* 底部导航栏 - 关键修复：确保它始终显示在底部 */
.chat-bottom-bar {
    height: 55px;
    background: #f7f7f7;
    border-top: 1px solid #dcdcdc;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0; /* 禁止被压缩 */
    position: relative; /* 确保层级正确 */
    z-index: 10; /* 确保在其他内容之上 */
}

.chat-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #1a1a1a;
    font-size: 10px;
    cursor: pointer;
    padding: 5px;
}

.chat-nav-btn i {
    font-size: 20px;
    margin-bottom: 2px;
}

/* 选中状态变黑 */
.chat-nav-btn.active { 
    color: #1a1a1a; 
}

/* -- 页面内容样式 -- */
.chat-tab-page { 
    padding-bottom: 0;
    height: 100%;
}

/* 消息列表项 */
.chat-list-item {
    display: flex;
    background: #fff;
    padding: 12px 15px; /* 调整左右内边距，使其在手机上更自然 */
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    cursor: pointer;
}

.chat-list-item:active {
    background: #f5f5f5;
}

.avatar-circle {
    width: 40px; 
    height: 40px;
    background: #07c160;
    border-radius: 6px;
    color: #fff;
    display: flex; 
    justify-content: center; 
    align-items: center;
    margin-right: 15px; /* 增加到15px，让文字离头像更远，更透气 */
    flex-shrink: 0;
}

.chat-text-col { 
    flex: 1;
    min-width: 0; /* 防止文字溢出 */
}

.chat-name { 
    font-weight: bold; 
    font-size: 15px; 
    color: #000; 
}

.chat-preview { 
    font-size: 12px; 
    color: #999; 
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time { 
    font-size: 10px; 
    color: #b2b2b2;
    flex-shrink: 0;
}

.chat-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0 4px;
    border-radius: 8px;
    background-color: #f44;
    color: #fff;
    font-size: 10px;
}

/* === 新增：聊天界面时间戳样式 === */
.chat-time-label {
    text-align: center;
    font-size: 12px;
    color: #b2b2b2; /* 浅灰色 */
    margin: 20px 0 10px 0; /* 上下留点空隙 */
    width: 100%;
    clear: both; /* 防止和浮动元素打架 */
}

/* 通讯录 & 更多样式 */
.section-title { 
    padding: 8px 12px; 
    background: #111111; 
    color: #666; 
    font-size: 12px; 
}

.contact-item, .menu-item {
    padding: 12px; 
    background: #fff; 
    border-bottom: 1px solid #f0f0f0; 
    display: flex; 
    align-items: center; 
    gap: 10px;
}

.more-header {
    background: #fff; 
    padding: 30px 20px; 
    display: flex; 
    align-items: center; 
    margin-bottom: 10px;
}

.moment-cover { 
    height: 150px; 
    background: #333; 
    margin-bottom: 20px; 
}

/* ==============================================
   === AI 角色创建器 (终极修复版) ===
   ============================================== */

/* 1. 核心容器：让弹窗浮在最上面，覆盖全屏 */
#ai-creator-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    color: white;
}

/* 2. 头部：只留标题 */
.creator-header {
    height: 50px;
    background-color: #1f1f1f;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: bold;
}

/* 3. 中间身体：负责滚动 */
.creator-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
}

/* --- 内部小组件 --- */

/* 头像上传区 */
.avatar-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 10px;
    cursor: pointer;
}

.avatar-upload-zone img {
    width: 90px; 
    height: 90px;
    border-radius: 50%;
    background: #333;
    object-fit: cover;
    border: 3px solid #444;
}

.avatar-upload-zone p { 
    color: #888; 
    font-size: 12px; 
    margin-top: 10px; 
}

/* 输入框组 */
.input-group { 
    margin-bottom: 25px; 
}

.input-group label {
    display: block;
    color: #888;
    font-size: 13px;
    margin-bottom: 8px;
    margin-left: 5px;
}

.input-group input, 
.input-group textarea, 
.input-group select {
    width: 100%;
    background-color: #2c2c2e;
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-size: 15px;
    box-sizing: border-box; 
    outline: none;
    font-family: inherit;
}

.input-group textarea {
    height: 100px;
    resize: none;
}

/* 选中高亮 */
.input-group input:focus,
.input-group textarea:focus {
    background-color: #3a3a3c;
    box-shadow: 0 0 0 1px #07c160;
}

/* --- 底部双按钮 --- */
.creator-footer-btns {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.cancel-btn-large, .save-btn-large {
    flex: 1;
    height: 50px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.cancel-btn-large { 
    background-color: #333; 
    color: #fff; 
}

.save-btn-large { 
    background-color: #07c160; 
    color: #fff; 
}
/* ==============================================
   === 朋友圈 (Moments) 高保真样式 ===
   === 请粘贴到 weixin.css 的最底部 ===
   ============================================== */

/* 1. 朋友圈容器：白色背景，允许滚动 */
#moments-view {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ffffff;
    position: relative;
    padding: 0;
    margin: 0;
}

/* 顶部导航栏：标题 + 相机图标，悬浮在封面上，不再占用高度 */
.moments-navbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(54px + max(20px, env(safe-area-inset-top, 0px)) + var(--device-top-offset, 0px));
    padding-top: calc(10px + max(20px, env(safe-area-inset-top, 0px)) + var(--device-top-offset, 0px));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: transparent;
    color: #fff;
    z-index: 5;
    pointer-events: auto;
    font-size: 17px;
    font-weight: 600;
    box-sizing: border-box;
}

.moments-navbar.scrolled {
    background: transparent;
}

.moments-nav-left {
    position: absolute;
    left: 12px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.moments-nav-left i,
.moments-nav-message i,
.moments-nav-role-publish i,
.moments-nav-camera i {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.moments-nav-title {
    text-align: center;
}

.moments-nav-camera {
    width: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
}

.moments-nav-actions {
    position: absolute;
    right: 9px;
    z-index: 2;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.moments-nav-message,
.moments-nav-role-publish {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.moments-nav-role-publish:active,
.moments-nav-message:active,
.moments-nav-camera:active {
    transform: scale(.92);
    opacity: .72;
}

.moments-nav-camera {
    position: relative;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

.moments-role-publisher-sheet {
    position: fixed;
    inset: 0;
    z-index: 22020;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.moments-role-publisher-sheet[hidden] {
    display: none;
}

.moments-role-publisher-mask {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(12, 12, 12, .28);
    opacity: 0;
    transition: opacity 220ms ease;
    -webkit-tap-highlight-color: transparent;
}

.moments-role-publisher-panel {
    position: relative;
    width: min(100%, 460px);
    max-height: min(72vh, 620px);
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 1px solid rgba(17, 17, 17, .055);
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    background: #f6f6f3;
    box-shadow: 0 -8px 34px rgba(0, 0, 0, .075);
    transform: translateY(18px);
    opacity: 0;
    transition: transform 240ms cubic-bezier(.22, .8, .3, 1), opacity 180ms ease;
}

.moments-role-publisher-sheet.is-open .moments-role-publisher-mask {
    opacity: 1;
}

.moments-role-publisher-sheet.is-open .moments-role-publisher-panel {
    transform: translateY(0);
    opacity: 1;
}

.moments-role-publisher-header {
    min-height: 54px;
    padding: 2px 2px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.moments-role-publisher-header small {
    display: block;
    margin-bottom: 4px;
    color: #aaa9a5;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 1.7px;
}

.moments-role-publisher-header h2 {
    margin: 0;
    color: #151515;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -.02em;
}

.moments-role-publisher-close {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 36px;
    border: 1px solid rgba(17, 17, 17, .06);
    border-radius: 50%;
    background: #fff;
    color: #202020;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
}

.moments-role-publisher-list {
    min-height: 80px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.moments-role-publisher-item {
    width: 100%;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid rgba(17, 17, 17, .055);
    border-radius: 20px;
    background: #fff;
    color: #151515;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .025);
    transition: transform 160ms ease, background 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

.moments-role-publisher-item:active {
    transform: scale(.985);
    background: #efefed;
}

.moments-role-publisher-item:disabled,
.moments-role-publisher-item.is-pending {
    cursor: default;
    opacity: .58;
}

.moments-role-publisher-item img {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 15px;
    object-fit: cover;
    background: #e7e7e4;
}

.moments-role-publisher-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.moments-role-publisher-copy strong {
    overflow: hidden;
    color: #171717;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.moments-role-publisher-copy small {
    color: #8d8c88;
    font-size: 11px;
    line-height: 1.35;
}

.moments-role-publisher-item > i {
    flex: 0 0 auto;
    color: #aaa9a5;
    font-size: 21px;
}

.moments-role-publisher-note {
    margin: 12px 2px 0;
    padding: 10px 12px;
    border-radius: 16px;
    background: #efefed;
    color: #747470;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    line-height: 1.5;
}

.moments-role-publisher-note i {
    margin-top: 1px;
    color: #353535;
    font-size: 16px;
}

.moments-role-publisher-empty {
    min-height: 150px;
    padding: 26px 18px;
    border: 1px solid rgba(17, 17, 17, .05);
    border-radius: 22px;
    background: #fff;
    color: #aaa9a5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.moments-role-publisher-empty i {
    margin-bottom: 3px;
    color: #747470;
    font-size: 25px;
}

.moments-role-publisher-empty strong {
    color: #4d4d4a;
    font-size: 14px;
    font-weight: 600;
}

.moments-role-publisher-empty span {
    font-size: 11px;
    line-height: 1.45;
}

/* --- 2. 顶部封面区域 --- */
.moments-header {
    position: relative;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 40px; /* 留出头像的一半高度，让它悬浮 */
    background: transparent;
}

.moments-cover {
    width: 100%;
    height: 320px; /* 封面高度 */
    background-color: #333;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* 用户信息悬浮 */
.moments-user-float {
    position: absolute;
    bottom: -24px; /* 稍微再往下，让头像更多悬浮在封面外 */
    right: 12px;
    display: flex;
    align-items: flex-end; /* 底部对齐 */
    gap: 12px;
    z-index: 2;
}

.moments-user-name {
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 8px; /* 把名字稍微抬高一点 */
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.moments-user-avatar {
    width: 68px;
    height: 68px;
    border-radius: 6px; /* 微信风格圆角 */
    object-fit: cover;
    background: #eee;
    border: 2px solid transparent; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    pointer-events: auto;
}

/* 朋友圈新消息：参考微信的小尺寸居中浮框 */
.moments-notification-banner {
    width: 188px;
    height: 48px;
    margin: 10px auto 12px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 15px;
    background: #5b5b5b;
    color: #fff;
    text-align: center;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.moments-notification-banner:active {
    background: #484848;
    transform: scale(0.99);
}

.moments-notification-banner-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 17px;
    flex: 0 0 auto;
}

.moments-notification-banner-text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.moments-notification-banner-arrow {
    color: rgba(255, 255, 255, 0.68);
    font-size: 17px;
}

.moments-interactions-page {
    min-height: 100%;
    background: #f7f9fc;
    color: #151515;
}

.moments-interactions-header {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 56px;
    padding: calc(max(8px, env(safe-area-inset-top, 0px)) + var(--device-top-offset, 0px)) 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid rgba(17, 17, 17, 0.065);
}

.moments-interactions-header h1 {
    width: 100%;
    margin: 0;
    padding: 0 60px;
    box-sizing: border-box;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .02em;
}

.moments-interactions-back,
.moments-interactions-regenerate-top {
    min-width: 40px;
    height: 36px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: #191919;
    cursor: pointer;
}

.moments-interactions-back { position: absolute; left: 10px; top: 50%; transform: translateY(-25%); font-size: 26px; }
.moments-interactions-regenerate-top { position: absolute; right: 12px; top: 50%; transform: translateY(-25%); min-width: 84px; height: 30px; padding: 0 12px; border-radius: 999px; background: #111; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; }
.moments-interactions-regenerate-top i { font-size: 16px; }
.moments-interactions-header-spacer { min-width: 40px; }

.moments-interactions-list { padding: 8px 0 24px; }

.moments-interaction-row {
    position: relative;
    min-height: 78px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    background: #fff;
    border-bottom: 1px solid rgba(17, 17, 17, 0.065);
}

.moments-interaction-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 10px;
    object-fit: cover;
    background: #e6eaf0;
}

.moments-interaction-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.moments-interaction-main strong { color: #151515; font-size: 15px; line-height: 1.3; }
.moments-interaction-action { color: #242424; font-size: 14px; line-height: 1.35; }
.moments-interaction-content { color: #69707a; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.moments-interaction-main small { color: #a1a8b2; font-size: 11px; margin-top: 3px; }
.moments-interaction-comment-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.moments-comment-rewrite-btn { min-height: 27px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid #eceff2; border-radius: 999px; background: #f7f8fa; color: #7a8490; font-size: 11px; line-height: 1; cursor: pointer; }
.moments-comment-rewrite-btn i { font-size: 14px; }
.moments-comment-rewrite-btn:active { background: #eef1f4; }
.moments-comment-rewrite-btn:disabled { opacity: .6; cursor: default; }
.moments-comment-rewrite-error { color: #a76d69; font-size: 11px; text-align: right; }
.moments-interaction-preview { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 8px; object-fit: cover; background: #f0f3f7; }
.moments-interaction-preview-empty { display: inline-flex; align-items: center; justify-content: center; color: #a1a8b2; font-size: 21px; }
.moments-interaction-row.is-error { align-items: center; }
.moments-interaction-row.is-error .moments-interaction-preview { display: none; }
.moments-interaction-row.is-interaction-error {
    min-height: 94px;
    margin: 10px 12px;
    padding: 15px;
    border: 1px solid rgba(17, 17, 17, 0.065);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.035);
}
.moments-interaction-system-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 21px;
}
.moments-regenerate-btn { min-width: 88px; height: 32px; padding: 0 12px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 999px; background: #111; color: #fff; font-size: 11px; font-weight: 600; cursor: pointer; }
.moments-regenerate-btn i { font-size: 15px; }
.moments-regenerate-btn:disabled,
.moments-interactions-regenerate-top:disabled { opacity: .52; cursor: default; }
.moments-regenerate-btn:active,
.moments-interactions-regenerate-top:active { opacity: .55; }
.moments-interactions-empty { padding: 64px 20px; color: #a1a8b2; text-align: center; font-size: 14px; }

.moments-notify-dot {
    position: absolute;
    top: 2px;
    right: calc(50% - 17px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fa5151;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}

.moment-post.moments-notification-target {
    animation: momentsNotificationTarget 900ms ease-out;
}

@keyframes momentsNotificationTarget {
    0% { background: #f1f1ee; }
    100% { background: #fff; }
}

/* --- 3. 单条动态 (Post) --- */
.moment-post {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f2f2f2; /* 极淡的分割线 */
    background: #fff;
    content-visibility: auto;
    contain-intrinsic-size: auto 220px;
}

#moments-view.is-opening .moments-navbar {
    color: #151515;
    background: rgba(255, 255, 255, .96);
}

.moments-opening-shell {
    min-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #a1a8b2;
    font-size: 12px;
    letter-spacing: .02em;
}

.moments-opening-pulse {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #151515;
    animation: momentsOpeningPulse 900ms ease-in-out infinite alternate;
}

@keyframes momentsOpeningPulse {
    from { opacity: .25; transform: scale(.82); }
    to { opacity: .85; transform: scale(1); }
}

/* 左侧头像 */
.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: #eee;
    margin-right: 10px;
    flex-shrink: 0;
    cursor: pointer;
}
.post-avatar img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
}

/* 右侧主体 */
.post-content {
    flex: 1;
    min-width: 0; /* 防止溢出 */
}

/* 昵称 (微信蓝) */
.post-nickname {
    color: #576b95;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
    cursor: pointer;
    line-height: 1.4;
}

/* 正文 */
.post-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 10px;
    word-break: break-all;
    white-space: pre-wrap;
}

/* --- 4. 九宫格图片布局 (核心) --- */
.post-images-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    max-width: 80%;
    margin-bottom: 10px;
}

.post-images-grid.one-img {
    grid-template-columns: 1fr;
    max-width: 70%;
}

.post-images-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-images-grid.three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background-color: #f0f0f0;
    cursor: zoom-in;
}

.post-img-wrap {
    position: relative;
    display: block;
    width: 100%;
    background-color: #f0f0f0;
    overflow: hidden;
}

.post-images-grid:not(.one-img) .post-img-wrap {
    aspect-ratio: 1 / 1;
}

.post-images-grid:not(.one-img) .post-img-wrap .post-img {
    height: 100%;
}

.post-images-grid.one-img .post-img {
    aspect-ratio: auto;
    width: 100%;
    height: auto;
    max-height: 320px;
}

.post-images-grid.one-img .post-img[data-moments-image-key] {
    min-height: 160px;
}

.post-img-regenerate-btn {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
    border: none;
    border-radius: 999px;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.84);
    color: #111827;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.post-img-wrap:hover .post-img-regenerate-btn,
.post-img-regenerate-btn:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.post-img-regenerate-btn i {
    font-size: 15px;
    line-height: 1;
}

.post-img-regenerate-btn:disabled,
.post-img-regenerate-btn.is-loading {
    opacity: 0.68;
    cursor: wait;
}

.moments-image-preview-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.moments-image-preview-actions .post-img-regenerate-btn,
.moments-image-preview-actions .post-img-edit-prompt-btn,
.moments-image-preview-actions .post-img-save-btn,
.post-img-regenerate-btn.is-preview {
    position: static;
    opacity: 1;
    transform: none;
    height: 36px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: none;
}

.post-img-save-btn {
    border-radius: 999px;
    height: 36px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #fff;
    color: #111;
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.moments-image-preview-actions .post-img-save-btn {
    background: #fff;
    color: #111;
}

.post-img-save-btn i { font-size: 15px; }
.post-img-save-btn:active { transform: scale(.97); }
.post-img-save-btn:disabled,
.post-img-save-btn.is-loading { opacity: .58; cursor: wait; }

.post-img-edit-prompt-btn {
    border-radius: 999px;
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.26);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.post-img-edit-prompt-btn i { font-size: 15px; }
.post-img-edit-prompt-btn:active { opacity: .62; }

.moments-image-prompt-editor {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    background: #f7f6f2;
    color: #171717;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, .28);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
}

.moments-image-prompt-editor.is-open {
    transform: translateY(0);
    visibility: visible;
}

.moments-image-prompt-editor-handle {
    width: 34px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 999px;
    background: #d6d4cd;
}

.moments-image-prompt-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.moments-image-prompt-editor-head > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.moments-image-prompt-editor-head span {
    color: #9b9991;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .16em;
}

.moments-image-prompt-editor-head strong {
    font-size: 17px;
    letter-spacing: .01em;
}

.moments-image-prompt-editor-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eceae4;
    color: #4e4d49;
    font-size: 21px;
    cursor: pointer;
}

#moments-image-prompt-input {
    width: 100%;
    min-height: 132px;
    max-height: 34vh;
    margin-top: 14px;
    padding: 13px 14px;
    box-sizing: border-box;
    resize: vertical;
    border: 1px solid #dedcd5;
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 14px;
    line-height: 1.65;
}

#moments-image-prompt-input:focus {
    border-color: #a3a097;
    box-shadow: 0 0 0 3px rgba(29, 29, 27, .06);
}

.moments-image-prompt-editor-foot {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.moments-image-prompt-editor-foot span {
    color: #8c8a83;
    font-size: 10px;
    line-height: 1.4;
}

.moments-image-prompt-save {
    min-width: 72px;
    height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #20201e;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.moments-image-prompt-save:active { transform: scale(.97); }

@media (hover: none) {
    .post-img-regenerate-btn {
        opacity: 0.92;
        transform: none;
    }
}

/* --- 5. 底部元数据栏 (时间、操作) --- */
.post-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    height: 24px;
    position: relative;
}

.post-meta-left {
    display: flex;
    align-items: center;
}

.post-time {
    font-size: 12px;
    color: #b2b2b2;
}

.post-visibility-flag {
    margin-left: 6px;
    font-size: 12px;
    color: #b2b2b2;
    display: inline-flex;
    align-items: center;
}
.post-visibility-flag i {
    font-size: 12px;
}

.post-delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #576b95;
    margin-left: 8px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

.post-delete-btn i {
    font-size: 12px;
}

/* 那个“两个点”的操作按钮 */
.post-action-btn {
    width: 32px;
    height: 20px;
    background: #f7f7f7;
    border-radius: 4px;
    color: #576b95;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 1px;
}

/* --- 6. 点赞/评论 弹出菜单 (黑条) --- */
.action-menu {
    position: absolute;
    right: 38px; /* 在按钮左边 */
    top: -6px;
    background: #4c4c4c;
    border-radius: 4px;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 5px;
    /* 动画初始状态 */
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width 0.2s ease-out, opacity 0.2s;
    z-index: 10;
}

.action-menu.show {
    width: 180px; /* 展开宽度 */
    opacity: 1;
}

.menu-item-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.menu-item-btn:first-child {
    border-right: 1px solid #333;
}
.menu-item-btn i {
    margin-right: 4px;
}

/* --- 7. 评论点赞区 (灰色盒子) --- */
.post-comments-area {
    background: #f3f3f3;
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 3px;
    font-size: 14px;
    position: relative;
    display: none; /* 默认隐藏，有内容才显示 */
}
/* 必须有内容才显示 */
.post-comments-area.has-content {
    display: block;
}

/* 小三角箭头 */
.post-comments-area::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 12px;
    width: 0; 
    height: 0; 
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #f3f3f3;
}

.like-list {
    color: #576b95;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}
.like-list.has-comments {
    border-bottom: 1px solid #dedede;
    padding-bottom: 5px;
    margin-bottom: 4px;
}
.like-list .moments-like-heart {
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1.25;
    color: #576b95;
}
.like-names {
    min-width: 0;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comment-row {
    color: #333;
    line-height: 1.45;
    white-space: pre-wrap;
    font-size: 0;
}
.comment-user,
.comment-reply-user {
    color: #576b95;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.comment-reply-label,
.comment-colon {
    color: #333;
    font-size: 13px;
}
.comment-reply-label {
    padding: 0 3px;
}
.comment-content {
    color: #333;
    white-space: pre-wrap;
    font-size: 13px;
}

/* 底部输入框 (模拟) */
#moments-input-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px)));
    background: rgba(247, 247, 247, 0.98);
    padding: 10px 12px;
    box-sizing: border-box;
    display: none;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #dcdcdc;
    z-index: 10001;
}
#moments-input-bar input {
    flex: 1;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    box-sizing: border-box;
}
#moments-input-bar button {
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: #07c160;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.comment-row {
    cursor: pointer;
}

/* 补充：防止头像图片变形（仅聊天头像占满容器，不影响朋友圈头像尺寸） */
.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moments-publish-modal {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff;
    display: none;
    flex-direction: column;
    z-index: 9999;
}

.moments-publish-nav {
    height: calc(44px + env(safe-area-inset-top, 0px) + var(--device-top-offset, 0px));
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top, 0px) + var(--device-top-offset, 0px)) 12px 0 12px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 16px;
    box-sizing: border-box;
}

.moments-publish-cancel {
    border: none;
    background: none;
    color: #576b95;
    font-size: 16px;
    padding: 4px 8px;
}

.moments-publish-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
}

.moments-publish-submit {
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 15px;
    background-color: #07c160;
    color: #ffffff;
}

.moments-publish-submit.disabled {
    background-color: #c7c7c7;
    color: #f5f5f5;
}

.moments-publish-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    overflow-y: auto;
}

.moments-publish-text {
    width: 100%;
    min-height: 90px;
    max-height: 200px;
    border: none;
    resize: none;
    font-size: 16px;
    outline: none;
    margin-bottom: 10px;
}

.moments-publish-images {
    margin-bottom: 15px;
}

.moments-publish-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.publish-img-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    border-radius: 6px;
    background-color: #f0f0f0;
}

.publish-img-item img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publish-img-remove {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.publish-img-add {
    width: 100%;
    padding-bottom: 0;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    border: 1px dashed #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    color: #c0c0c0;
}

.moments-publish-options {
    margin-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.publish-option-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
}

.option-icon {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #8e8e93;
}

.option-text {
    flex: 1;
}

.option-extra {
    margin-right: 6px;
    font-size: 13px;
    color: #8e8e93;
    max-width: 50%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-arrow {
    color: #c7c7c7;
}

.moments-visibility-sheet {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 20001;
}

.moments-visibility-mask {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
}

.moments-visibility-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #f7f7f7;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    padding-bottom: var(--safe-bottom-compact, env(safe-area-inset-bottom));
}

.moments-visibility-option {
    background: #ffffff;
    padding: 14px 16px;
    text-align: center;
    font-size: 16px;
    color: #000;
    border-bottom: 1px solid #f0f0f0;
}

.moments-visibility-option:active {
    background: #e5e5e5;
}

.moments-visibility-cancel {
    margin-top: 8px;
    background: #ffffff;
    padding: 14px 16px;
    text-align: center;
    font-size: 16px;
    color: #007aff;
}

.moments-visibility-cancel:active {
    background: #e5e5e5;
}
