/* mainweixin.css - 完整无省略版 V6.1 */
/* 包含：深色模式适配、底部导航防遮挡修复、背景透视修复、菜单点击修复、评论区配色修复 */

/* ========================================= */
/* 0. 全局变量定义 (核心适配层)               */
/* ========================================= */
:root {
    /* --- 白昼模式 (Light Mode) --- */
    --bg-color: #f7f7f7;            /* 页面大背景 */
    --card-bg: #ffffff;             /* 卡片/列表项背景 */
    --header-bg-color: #ededed;     /* 顶部/底部导航栏背景 */
    --header-border: #e0e0e0;       /* 边框颜色 */
    
    --primary-text: #000000;        /* 主标题文字 */
    --secondary-text: #999999;      /* 次要文字、时间 */
    --placeholder-text: #b2b2b2;    /* 搜索框提示文字 */
    
    --accent-color: #1a73e8;        /* 强调色(蓝) */
    --online-color: #2ecc71;        /* 在线状态绿 */
    --badge-color: #fa3e3e;         /* 红点颜色 */
    
    --input-bg: #ffffff;            /* 输入框背景 */
    --hover-bg: #f5f5f5;            /* 悬停/按下背景 */
    
    /* 聊天气泡 */
    --bubble-sent: #95ec69;         /* 发送方(微信绿) */
    --bubble-received: #ffffff;     /* 接收方(白) */
    --bubble-text: #000000;         /* 气泡文字颜色 */
    
    /* 动态评论区专用 */
    --comment-bg: #f7f7f7;          /* 评论区底色 */
    --comment-text: #333333;        /* 评论文字 */
    --like-area-bg: #f7f7f7;        /* 点赞区底色 */
    
    /* 底部预留高度 (用于计算) */
    --mobile-nav-height: 50px; 
}

/* --- 月蚀模式 (Dark Mode) --- */
[data-theme="dark"] {
    --bg-color: #000000;            /* 纯黑背景 */
    --card-bg: #1c1c1e;             /* 深灰卡片 */
    --header-bg-color: #1c1c1e;     /* 头部与卡片同色 */
    --header-border: #2c2c2e;       /* 深色边框 */
    
    --primary-text: #ffffff;        /* 文字反白 */
    --secondary-text: #8e8e93;      /* 次要文字变灰 */
    --placeholder-text: #636366;
    
    --accent-color: #0a84ff;        /* 蓝色稍微提亮 */
    
    --input-bg: #2c2c2e;            /* 输入框深灰 */
    --hover-bg: #2c2c2e;            /* 悬停深灰 */
    
    /* 聊天气泡反转 */
    --bubble-sent: #2b8337;         /* 深绿色 */
    --bubble-received: #2c2c2e;     /* 深灰色 */
    --bubble-text: #ffffff;         /* 文字白色 */
    
    /* 【重点修复】动态评论区深色适配 */
    --comment-bg: #2c2c2e;          /* 深灰底 */
    --comment-text: #d1d1d6;        /* 浅灰白字 */
    --like-area-bg: #2c2c2e;        /* 点赞区深灰 */
}

/* ========================================= */
/* 1. 基础重置 & 全局样式                    */
/* ========================================= */
* {
    /* 关键代码：设置为透明，去除点击高亮 */
    -webkit-tap-highlight-color: transparent !important;
    box-sizing: border-box; 
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;      
    height: 100%;     
    overflow: hidden; /* 禁止页面整体滚动 */
    overscroll-behavior: none; /* 禁止橡皮筋 */
    position: fixed;  /* 钉死视窗 */
    left: 0;
    top: 0;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color); /* 适配变量 */
    color: var(--primary-text);        /* 适配变量 */
    display: flex;
    justify-content: center;
    align-items: center;
    
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100%;
    max-width: 480px; 
    height: 100%;
    max-height: 90vh; /* PC端视图限制 */
    background-color: var(--bg-color); 
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; 
}

/* ========================================= */
/* 2. 顶部区域 Header                        */
/* ========================================= */
.app-header {
    background-color: var(--header-bg-color); 
    padding: 15px;
    padding-top: max(15px, env(safe-area-inset-top)); 
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; 
    position: relative;
    /* 【修复点击无效】层级必须足够高且overflow visible */
    z-index: 100; 
    overflow: visible !important; 
    border-bottom: 1px solid var(--header-border); 
    transition: background-color 0.3s;
}

.user-info {
    display: flex;
    align-items: center;
}
.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    background-color: var(--input-bg);
}
#user-username {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 4px 0;
    color: var(--primary-text); 
}
.status {
    font-size: 12px;
    color: var(--secondary-text); 
    margin: 0;
    display: flex;
    align-items: center;
}
.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--online-color); 
    border-radius: 50%;
    margin-right: 5px;
}
.action-icon {
    font-size: 24px;
    color: var(--primary-text); 
    cursor: pointer;
    padding: 5px; 
}

/* ========================================= */
/* 3. 主要内容区域 Main                      */
/* ========================================= */
.app-main {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 0; 
    background-color: var(--card-bg); 
    /* 这里的 padding 为了避免最后一条列表项贴底 */
    padding-bottom: 10px; 
    -webkit-overflow-scrolling: touch;
    
    /* 修复自定义背景下不显示的问题 */
    transition: background-color 0.3s;
}

/* 搜索框 */
.search-bar {
    padding: 10px 15px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    background-color: var(--bg-color); 
}

.search-bar input {
    border: none;
    outline: none;
    background: var(--card-bg); 
    width: 100%;
    font-size: 14px;
    color: var(--primary-text); 
    padding: 8px 12px 8px 30px; 
    border-radius: 6px;
}
.search-icon {
    color: var(--secondary-text); 
    position: absolute; 
    left: 25px;
    font-size: 12px;
}

/* 消息列表 */
.chat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px; 
    cursor: pointer;
    border-bottom: 1px solid var(--header-border); 
    background-color: var(--card-bg); 
}
.chat-item:last-child {
    border-bottom: none;
}
.chat-item:hover, .chat-item:active {
    background-color: var(--hover-bg); 
}
.avatar-container {
    position: relative;
    margin-right: 12px;
}
.avatar-container img {
    width: 50px;
    height: 50px;
    border-radius: 6px; 
    object-fit: cover;
}
.unread-badge { 
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--badge-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    border: 1px solid white;
}
.message-content {
    flex-grow: 1;
    overflow: hidden;
}
.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.sender-name {
    font-weight: 500;
    font-size: 16px;
    color: var(--primary-text); 
}
.message-time {
    font-size: 12px;
    color: var(--secondary-text); 
}
.message-preview {
    font-size: 14px;
    color: var(--secondary-text); 
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================= */
/* 4. APP内部底部 TabBar (内部切换)          */
/* ========================================= */
.app-footer {
    background-color: var(--header-bg-color); 
    border-top: 1px solid var(--header-border); 
    flex-shrink: 0; 
    
    /* 保持正常，因为我们在 body 层面压缩了整体高度，这里不需要额外的大 padding */
    padding-bottom: env(safe-area-inset-bottom);
}
.tab-bar {
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
}
.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-text); 
    padding: 5px 10px;
    position: relative;
    flex: 1;
}
.tab-item i {
    font-size: 22px;
    margin-bottom: 3px;
}
.tab-item span {
    font-size: 12px;
}
.tab-item.active {
    color: var(--accent-color); 
}
.nav-badge {
    position: absolute;
    top: 2px;
    right: 0;
    background-color: var(--badge-color);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
}
.nav-dot {
    position: absolute;
    top: 5px;
    right: 12px;
    width: 8px;
    height: 8px;
    background-color: var(--badge-color);
    border-radius: 50%;
}

/* ========================================= */
/* 5. 顶部 "+" 号弹出菜单样式 (点击修复)     */
/* ========================================= */
.action-menu {
    position: absolute;
    top: 60px;
    right: 15px;
    background-color: var(--card-bg); 
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    
    /* 【修复点击无效】层级必须高于一切列表内容 */
    z-index: 9999; 
    width: 160px;
    overflow: hidden;
    
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    pointer-events: none;
}

.action-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto; /* 关键：显示时允许点击 */
}

.action-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--card-bg); 
}

.action-menu ul {
    list-style: none;
    padding: 5px 0;
    margin: 0;
}

.action-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--primary-text); 
    text-decoration: none;
    font-size: 15px;
    /* 确保可点击区域填满 */
    width: 100%; height: 100%; 
}

.action-menu li a:hover, .action-menu li a:active {
    background-color: var(--hover-bg); 
}

.action-menu li a i {
    margin-right: 12px;
    font-size: 16px;
    width: 20px; text-align: center;
}

/* ========================================= */
/* 6. 自定义背景适配 (Glassmorphism)         */
/* ========================================= */

/* 当应用容器有自定义背景时 */
.app-container.has-custom-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 半透明处理 */
.app-container.has-custom-bg .app-header,
.app-container.has-custom-bg .app-footer,
.app-container.has-custom-bg .search-bar {
    background-color: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
}
/* 黑夜模式半透明 */
[data-theme="dark"] .app-container.has-custom-bg .app-header,
[data-theme="dark"] .app-container.has-custom-bg .app-footer,
[data-theme="dark"] .app-container.has-custom-bg .search-bar {
    background-color: rgba(0, 0, 0, 0.4); 
}

/* 【修复聊天页面背景图不显示】强制透明 */
.app-container.has-custom-bg .app-main { background: transparent !important; }
.app-container.has-custom-bg .chat-messages { background: transparent !important; }

/* 列表项半透明 */
.app-container.has-custom-bg .chat-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); 
    background-color: transparent; 
}

.app-container.has-custom-bg .chat-item:hover {
    background-color: rgba(255, 255, 255, 0.1); 
}

/* 文字变白 */
.app-container.has-custom-bg .sender-name,
.app-container.has-custom-bg .message-time,
.app-container.has-custom-bg .message-preview,
.app-container.has-custom-bg .app-header .status,
.app-container.has-custom-bg .action-icon,
.app-container.has-custom-bg .tab-item,
.app-container.has-custom-bg .search-icon 
{
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* 增加文字阴影保证可读性 */
}

.app-container.has-custom-bg .search-bar input {
    background: rgba(255,255,255, 0.2);
    color: #fff;
}

/* 菜单深色磨砂 */
.app-container.has-custom-bg .action-menu {
    background-color: rgba(40, 40, 40, 0.85);
    backdrop-filter: blur(10px);
}
.app-container.has-custom-bg .action-menu::before {
    border-bottom-color: rgba(40, 40, 40, 0.85);
}
.app-container.has-custom-bg .action-menu li a {
    color: #fff;
}

/* ========================================= */
/* 7. 聊天详情视图 (Chat View)               */
/* ========================================= */
#chat-list-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    transition: opacity 0.2s ease;
}
#chat-list-view.hidden-content {
    opacity: 0; 
}

#chat-view-container {
    display: flex;
    flex-direction: column;
    
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    
    /* 🔥【核心修改 1】🔥 */
    /* 以前是 bottom: 0 (会被黑条挡住) */
    /* 现在改成 bottom: 50px (手动把脚收回来，给黑条腾地方) */
    /* 这里的 50px 是大多数安卓导航栏的高度 */
    bottom: 50px; 
    
    /* 配合这个，让浏览器自动计算高度 */
    height: auto !important; 
    
    z-index: 1000; 
    /* ...其他背景色、阴影等保持不变... */
    background-color: var(--bg-color); 
    transform: translate3d(100%, 0, 0); 
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}
#chat-view-container.active {
    transform: translate3d(0, 0, 0); 
}

/* 自定义背景下：聊天大容器必须透明 */
.app-container.has-custom-bg #chat-view-container {
    background-color: transparent !important; 
}

.chat-header {
    background-color: var(--header-bg-color); 
    border-bottom: 1px solid var(--header-border); 
    padding: 0 15px;
    height: 50px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding-top: max(10px, env(safe-area-inset-top)); 
}

.chat-header h2 {
    font-size: 17px;
    color: var(--primary-text); 
    margin: 0;
    font-weight: 600;
}

.back-icon, .menu-icon {
    color: var(--primary-text); 
    font-size: 20px;
    padding: 10px;
    cursor: pointer;
}

.chat-input-area {
    background-color: var(--header-bg-color); 
    border-top: 1px solid var(--header-border); 
    padding: 10px 15px;      
    padding-bottom: 10px; /* 稍微留一点点缝隙即可 */
    
    flex-shrink: 0;
}


/* 玻璃风格适配 */
.app-container.has-custom-bg .chat-header,
.app-container.has-custom-bg .chat-input-area {
    background-color: rgba(240, 240, 240, 0.7); 
    border: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
[data-theme="dark"] .app-container.has-custom-bg .chat-header,
[data-theme="dark"] .app-container.has-custom-bg .chat-input-area {
    background-color: rgba(30, 30, 30, 0.7);
}

.input-container {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.message-input {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: var(--input-bg); 
    color: var(--primary-text); 
    font-size: 16px;
}

.send-button {
    margin-left: 10px;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background-color: var(--accent-color); 
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.toolbar {
    display: flex;
    justify-content: space-around;
    padding-bottom: 5px;
}

.toolbar i {
    font-size: 24px;
    color: var(--secondary-text); 
    cursor: pointer;
}

/* 聊天气泡 */
.chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: var(--bg-color); 
    -webkit-overflow-scrolling: touch; 
    scroll-behavior: smooth;
    /* 【修复遮挡】给底部留出更多空间，防止最后一条消息被输入框或导航遮挡 */
    padding-bottom: 20px; 
}

.message-bubble {
    display: flex;
    margin-bottom: 18px;
    max-width: 85%;
    align-items: flex-start;
    position: relative;
}

.message-bubble .bubble-avatar {
    width: 50px;  
    height: 50px; 
    border-radius: 50%; 
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    contain: strict; 
    background-color: var(--input-bg); 
    will-change: transform;
}

.message-bubble .bubble-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 17px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-height: 24px;
    display: flex;
    align-items: center;
    color: var(--bubble-text); 
}

/* AI 助手 (左侧) */
.message-bubble.assistant {
    align-self: flex-start;
    margin-right: auto;
}
.message-bubble.assistant .bubble-avatar {
    margin-right: 12px;
}
.message-bubble.assistant .bubble-content {
    background-color: var(--bubble-received); 
    color: var(--primary-text); /* 正常文字色 */
    border-top-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* 用户 (右侧) */
.message-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}
.message-bubble.user .bubble-avatar {
    margin-left: 12px;
}
.message-bubble.user .bubble-content {
    background-color: var(--bubble-sent); 
    color: #000; /* 微信绿背景下，文字通常保持黑色 */
    border-top-right-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
/* 深色模式下修正用户气泡文字颜色 (如果是深绿背景，白色字更好) */
[data-theme="dark"] .message-bubble.user .bubble-content {
    color: #fff;
}

/* 正在输入动画 */
.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 1px;
    animation: typing-blink 1.4s infinite both;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* 红点样式 */
.chat-item .avatar-container {
    position: relative; 
    overflow: visible; 
}
.chat-item .unread-dot {
    display: none;
    position: absolute;
    right: -5px;
    top: -5px;
    background-color: var(--badge-color);
    color: white;
    font-size: 10px;
    height: 16px;
    min-width: 16px; 
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 3px;
    border: 1px solid var(--card-bg); /* 边框适配背景色 */
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 5;
}
.chat-item.has-unread .unread-dot {
    display: block;
}

/* ========================================= */
/* 8. 联系人页面 (Contacts)                  */
/* ========================================= */
.contact-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--header-border); 
    background-color: var(--card-bg); 
}
.contact-menu-item span { color: var(--primary-text); }

.menu-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
    color: white;
    font-size: 18px;
}
.menu-icon-box.orange { background-color: #faad14; }
.menu-icon-box.green { background-color: #52c41a; }

.contact-groups { margin-top: 10px; }
.group-item { margin-bottom: 5px; }

.group-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    color: var(--secondary-text); 
    font-size: 14px;
    background-color: var(--bg-color);
}
.group-header:hover { color: var(--primary-text); }

.group-arrow {
    margin-right: 8px;
    transition: transform 0.2s;
    font-size: 12px;
}
.group-item.collapsed .group-arrow { transform: rotate(-90deg); }
.group-item.collapsed .group-content { display: none; }
.group-title { flex-grow: 1; font-weight: 500; }
.group-count { font-size: 12px; }

.friend-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    background-color: var(--card-bg); 
    border-bottom: 1px solid var(--header-border);
}
.friend-item:active {
    background-color: var(--hover-bg); 
}

.friend-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}
.friend-info { flex-grow: 1; overflow: hidden; }
.friend-top { display: flex; align-items: flex-end; margin-bottom: 3px; }
.friend-name { font-size: 16px; color: var(--primary-text); margin-right: 5px; font-weight: 500; }
.friend-status-text { font-size: 12px; color: var(--secondary-text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.friend-status-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; display: inline-block; }
.friend-status-dot.online { background-color: #2ecc71; }
.friend-status-dot.offline { background-color: #95a5a6; }

/* ========================================= */
/* 9. 全屏动态页 (Feed)                      */
/* ========================================= */
#view-feed-fullscreen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 3000;
    background-color: var(--bg-color); 
    overflow-y: auto; overflow-x: hidden;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    -webkit-overflow-scrolling: touch;
    
    /* 【修复遮挡】给底部留白 */
    padding-bottom: var(--mobile-nav-height); 
}
#view-feed-fullscreen.active { transform: translateX(0); }

.feed-header-container {
    background-color: var(--card-bg); 
    padding-bottom: 15px;
    margin-bottom: 10px;
    position: relative;
}

.feed-bg-image {
    height: 260px;
    background-size: cover;
    background-position: center;
    background-color: #a1c4fd;
    position: relative;
    background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
}

.feed-top-bar {
    display: flex; justify-content: space-between; padding: 15px;
    padding-top: max(15px, env(safe-area-inset-top)); 
    position: absolute; top: 0; left: 0; width: 100%; box-sizing: border-box; z-index: 10;
}
.icon-btn {
    width: 32px; height: 32px; background-color: rgba(0,0,0,0.3);
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    color: white; font-size: 16px; cursor: pointer; backdrop-filter: blur(4px);
}
.feed-top-bar .right-icons { display: flex; gap: 10px; }

.feed-user-section {
    display: flex; padding: 0 15px; margin-top: -35px;
    position: relative; z-index: 2; align-items: flex-end;
}
.feed-avatar-wrapper { position: relative; margin-right: 15px; }
#feed-user-avatar {
    width: 75px; height: 75px; border-radius: 50%;
    border: 3px solid var(--card-bg); /* 边框颜色适配 */
    object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: var(--card-bg);
}

.feed-user-info { padding-bottom: 5px; }
#feed-username {
    margin: 0; font-size: 20px; font-weight: bold; color: var(--primary-text); 
    margin-bottom: 2px;
}

.visit-count { font-size: 12px; color: var(--secondary-text); display: flex; align-items: center; }

.feed-input-section {
    background-color: var(--card-bg); 
    padding: 10px 15px; margin-bottom: 10px;
}
.feed-input-box {
    background-color: var(--hover-bg); 
    border-radius: 20px; padding: 10px 15px;
    display: flex; justify-content: space-between; align-items: center;
    color: var(--secondary-text); font-size: 14px; cursor: pointer;
}
.input-icons i { margin-left: 15px; font-size: 18px; color: var(--secondary-text); }

.feed-item {
    background-color: var(--card-bg); 
    margin-bottom: 10px; padding: 15px;
}
.feed-item-header { display: flex; align-items: center; margin-bottom: 10px; }
.feed-p-avatar { width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; object-fit: cover; }
.feed-p-info { flex-grow: 1; }
.feed-p-name { font-size: 16px; font-weight: bold; color: #576b95; }
.feed-p-more { color: var(--secondary-text); }
.feed-item-content { margin-bottom: 10px; }
.feed-text { font-size: 15px; line-height: 1.5; margin: 0 0 10px 0; color: var(--primary-text); word-wrap: break-word; }
.feed-media img { width: 100%; max-height: 400px; object-fit: cover; border-radius: 8px; display: block; }
.feed-item-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; margin-top: 10px; }
.feed-time { font-size: 12px; color: var(--secondary-text); }
.feed-actions { display: flex; gap: 25px; color: var(--secondary-text); font-size: 18px; }

/* 【重点修复】评论区配色 */
.feed-likes-area {
    background-color: var(--like-area-bg); /* 适配变量 */
    padding: 10px; border-top-left-radius: 6px; border-top-right-radius: 6px;
    font-size: 13px; color: #576b95; line-height: 1.5; display: flex; margin-top: 5px;
}
.like-icon-small { margin-right: 6px; margin-top: 3px; font-size: 12px; color: #576b95; }

.feed-comments-section {
    background: var(--comment-bg); /* 适配变量 */
    padding: 10px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px;
    font-size: 13px; line-height: 1.5;
}
.comment-row { margin-bottom: 2px; }
.comment-user { color: #576b95; font-weight: 500; }
.comment-content { color: var(--comment-text); /* 字体颜色适配 */ }

/* ========================================= */
/* 10. 全屏设置页面系统 (Settings UI)        */
/* ========================================= */
.full-screen-page {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
    background-color: var(--bg-color); 
    z-index: 2000; 
    display: flex; flex-direction: column;
    transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    
    /* 【修复遮挡】 */
    padding-bottom: var(--mobile-nav-height); 
}
.full-screen-page.active { transform: translateX(0); }
.sub-page { z-index: 2010; background-color: var(--card-bg); }

.page-header {
    height: 50px; background-color: var(--card-bg); 
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; border-bottom: 1px solid var(--header-border); 
    flex-shrink: 0; padding-top: max(0px, env(safe-area-inset-top));
}
.page-header .header-center { font-size: 17px; font-weight: bold; color: var(--primary-text); }
.page-header .back-icon { font-size: 20px; padding: 10px 10px 10px 0; color: var(--primary-text); cursor: pointer; }
.header-text-btn { background: none; border: none; color: #576b95; font-size: 16px; font-weight: 500; cursor: pointer; }

.page-content { flex: 1; overflow-y: auto; padding: 15px; -webkit-overflow-scrolling: touch; }

.settings-list {
    margin-top: 15px; background-color: var(--card-bg); 
    border-top: 1px solid var(--header-border); border-bottom: 1px solid var(--header-border);
}

.setting-item {
    display: flex; align-items: center; padding: 15px;
    cursor: pointer; position: relative; background-color: var(--card-bg);
}
.setting-item::after {
    content: ''; position: absolute; bottom: 0; left: 60px; right: 0;
    height: 1px; background-color: var(--header-border); 
}
.setting-item:last-child::after { display: none; }
.setting-item:active { background-color: var(--hover-bg); }

.item-icon {
    width: 30px; height: 30px; border-radius: 6px; color: white;
    display: flex; justify-content: center; align-items: center; margin-right: 15px; font-size: 16px;
}
.color-blue { background-color: #1890ff; }
.color-green { background-color: #52c41a; }
.color-pink { background-color: #fa3e3e; }
.color-purple { background-color: #9c27b0; }

.item-content { flex-grow: 1; display: flex; flex-direction: column; }
.item-title { font-size: 16px; color: var(--primary-text); margin-bottom: 3px; }
.item-desc { font-size: 12px; color: var(--secondary-text); }
.item-arrow { color: var(--secondary-text); font-size: 14px; }

/* 背景预览区 */
.bg-preview-area {
    height: 200px; background-color: var(--hover-bg); 
    border-radius: 12px; display: flex; justify-content: center; align-items: center;
    cursor: pointer; border: 2px dashed var(--header-border); color: var(--secondary-text);
    position: relative; overflow: hidden; background-size: cover; background-position: center; background-repeat: no-repeat;
    transition: all 0.3s ease;
}
.bg-preview-area.has-image { border: none; }
.bg-preview-area .bg-placeholder {
    text-align: center; position: relative; z-index: 2;
    background-color: rgba(0, 0, 0, 0.4); padding: 15px 25px;
    border-radius: 20px; backdrop-filter: blur(4px); color: #fff;
    opacity: 0; transition: opacity 0.3s;
}
.bg-preview-area:not(.has-image) .bg-placeholder {
    opacity: 1; background-color: transparent; color: var(--secondary-text); backdrop-filter: none;
}
.bg-preview-area.has-image:hover .bg-placeholder { opacity: 1; }
.bg-preview-area i { font-size: 40px; margin-bottom: 10px; display: block; }

/* 滑块盒子 */
.setting-slider-box {
    margin-top: 30px; padding: 20px;
    background-color: var(--bg-color); 
    border-radius: 10px;
}
.setting-slider-box label { display: block; margin-bottom: 15px; font-weight: bold; font-size: 15px; color: var(--primary-text); }
.slider-container { display: flex; align-items: center; gap: 15px; }
.slider-container i { color: var(--secondary-text); }
.slider-container input[type=range] { flex-grow: 1; }

#settings-info-form .form-group {
    background: var(--card-bg); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--header-border);
}
#settings-info-form label { display: block; color: var(--secondary-text); font-size: 13px; margin-bottom: 5px; }
#settings-info-form input, #settings-info-form select, #settings-info-form textarea {
    width: 100%; border: none; font-size: 16px; outline: none; background: transparent; color: var(--primary-text);
}

/* ========================================= */
/* 11. 启动引导层 (Startup Overlay)          */
/* ========================================= */
#startup-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
    background-color: var(--card-bg); 
    z-index: 9999; display: flex; justify-content: center; align-items: center;
    transition: opacity 0.8s ease;
}
.scene {
    position: absolute; width: 100%; height: 100%; display: none;
    flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.5s ease;
}
.scene.active { display: flex; opacity: 1; }

.logo-area { text-align: center; margin-bottom: 50px; }
.app-logo-box {
    width: 80px; height: 80px; background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
    border-radius: 20px; display: flex; justify-content: center; align-items: center;
    font-size: 40px; color: white; margin: 0 auto 20px;
    box-shadow: 0 10px 20px rgba(166, 193, 238, 0.5); animation: floatLogo 3s ease-in-out infinite;
}
@keyframes floatLogo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.fade-up-text {
    font-size: 24px; font-weight: 300; margin: 5px 0; color: var(--primary-text);
    opacity: 0; transform: translateY(20px); animation: fadeUp 1s ease forwards;
}
.fade-up-text.delay-1 { 
    font-weight: bold; font-size: 32px; animation-delay: 0.3s; 
    background: -webkit-linear-gradient(45deg, #ff9a9e, #fad0c4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.loading-spinner {
    width: 30px; height: 30px; border: 3px solid var(--hover-bg); border-top: 3px solid #a6c1ee;
    border-radius: 50%; animation: spin 1s linear infinite; position: absolute; bottom: 100px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.intro-text-container { text-align: center; margin-bottom: 60px; }
.intro-line {
    font-size: 20px; color: var(--primary-text); margin: 20px 0;
    opacity: 0; transition: opacity 1s, transform 1s; transform: scale(0.9);
}
.intro-line.show { opacity: 1; transform: scale(1); }
.intro-line.highlight { font-size: 26px; font-weight: bold; color: var(--accent-color); }

.btn-setup {
    padding: 12px 40px; border-radius: 30px; background: linear-gradient(90deg, #1a73e8, #4285f4);
    color: white; font-size: 16px; border: none; box-shadow: 0 5px 15px rgba(26, 115, 232, 0.3);
    cursor: pointer; opacity: 0; transform: translateY(20px); transition: all 0.5s ease;
}
.btn-setup.show { opacity: 1; transform: translateY(0); }

#scene-setup { background-color: var(--bg-color); align-items: flex-start; overflow-y: auto; }
.setup-container { width: 100%; padding: 40px 30px; box-sizing: border-box; max-width: 500px; margin: 0 auto; }
.setup-title { font-size: 28px; color: var(--primary-text); margin: 20px 0 10px 0; }
.setup-subtitle { color: var(--secondary-text); margin-bottom: 40px; font-size: 14px; }
.setup-group { margin-bottom: 25px; }
.setup-row { display: flex; gap: 15px; }
.setup-group.half { flex: 1; }
.setup-group label { display: block; font-size: 14px; color: var(--secondary-text); margin-bottom: 8px; font-weight: 500; }
.setup-group input, .setup-group select, .setup-group textarea {
    width: 100%; background: transparent; border: none; border-bottom: 2px solid var(--header-border);
    padding: 10px 0; font-size: 18px; color: var(--primary-text); border-radius: 0; transition: border-color 0.3s;
}
.setup-group input:focus, .setup-group textarea:focus, .setup-group select:focus {
    outline: none; border-bottom-color: var(--accent-color);
}
.btn-finish-setup {
    width: 100%; margin-top: 30px; padding: 15px; border-radius: 12px;
    background: var(--primary-text); color: var(--card-bg); /* 反色按钮 */
    font-size: 16px; font-weight: bold; border: none; cursor: pointer; box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.btn-finish-setup:active { transform: scale(0.98); }

/* ========================================= */
/* 12. 创建角色页样式 (Role Editor)          */
/* ========================================= */
.editor-avatar-section {
    display: flex; justify-content: center; padding: 30px 0; background-color: var(--card-bg);
}
.avatar-wrapper {
    position: relative; width: 90px; height: 90px; border-radius: 50%; overflow: hidden;
    cursor: pointer; background-color: var(--hover-bg); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
#editor-avatar-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-tip {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6); display: flex; flex-direction: column;
    justify-content: center; align-items: center; color: white; opacity: 1; transition: background-color 0.3s;
}
.avatar-tip i { font-size: 24px; margin-bottom: 6px; }
.avatar-tip span { font-size: 11px; font-weight: bold; }

#view-create-role .page-content { background-color: var(--card-bg) !important; }

#view-create-role .form-group {
    border-bottom: 1px solid var(--header-border); margin-bottom: 25px; padding-bottom: 8px; transition: border-color 0.3s;
}
#view-create-role .form-group:focus-within { border-bottom-color: var(--accent-color); }
.form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#view-create-role label { font-size: 14px; color: var(--secondary-text); font-weight: bold; margin: 0; }
.word-count { font-size: 12px; color: var(--secondary-text); }
.word-count.over-limit { color: #ff4d4f; font-weight: bold; }
.form-group.has-error { border-bottom-color: #ff4d4f !important; }

#view-create-role input, #view-create-role textarea {
    border: none; font-size: 17px; background: transparent; padding: 5px 0; width: 100%; outline: none; color: var(--primary-text);
}
#view-create-role textarea { resize: none; font-family: inherit; }

/* ========================================= */
/* 13. 提示框 Toast                          */
/* ========================================= */
#toast-message {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
    background-color: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px;
    border-radius: 25px; font-size: 14px; z-index: 9999; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none; white-space: nowrap;
}
#toast-message.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.btn-simple-remove {
    background: transparent; border: 1px solid var(--header-border); color: var(--secondary-text);
    padding: 5px 10px; border-radius: 4px; font-size: 12px; margin-top: 8px; cursor: pointer; width: 100%;
}
.btn-simple-remove:active { background: var(--hover-bg); }

/* ========================================= */
/* 14. 下拉刷新 (Pull to Refresh)            */
/* ========================================= */
#ptr-loader {
    position: absolute; top: 15px; left: 0; width: 100%; height: 40px;
    display: flex; justify-content: center; align-items: center; color: var(--secondary-text);
    font-size: 13px; z-index: 0; pointer-events: none;
}
#ptr-loader i { margin-right: 8px; font-size: 16px; display: none; }
#feed-content-wrapper {
    position: relative; z-index: 10; background-color: var(--bg-color); min-height: 100%;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
#feed-content-wrapper.pulling { transition: none; }
#ptr-loader.loading i { display: inline-block; }

/* ========================================= */
/* 15. 滚动条隐藏优化                        */
/* ========================================= */
.chat-messages::-webkit-scrollbar, .app-main::-webkit-scrollbar, .feed-list::-webkit-scrollbar, .step-content::-webkit-scrollbar {
    display: none; width: 0 !important; height: 0 !important; background: transparent;
}
.chat-messages, .app-main, .feed-list, .step-content {
    scrollbar-width: none; -ms-overflow-style: none;
}
/* ========================================= */
/* 18. 修复：动态全屏页层级提升              */
/* ========================================= */
#view-feed-fullscreen {
    /* 必须比 .full-screen-page.sub-page (5010) 还要高 */
    z-index: 6000 !important; 
}
/* ========================================= */
/* 19. 修复：动态评论区黑夜模式适配          */
/* ========================================= */

/* 1. 评论区容器基础样式 (补回刚才JS删掉的那些) */
.feed-comments-section {
    background-color: var(--comment-bg); /* 使用变量 */
    padding: 10px;
    border-radius: 4px; /* 圆角 */
    font-size: 13px;
    line-height: 1.5;
    margin-top: 5px;
}

/* 2. 评论列表容器 */
.comments-list {
    margin-top: 5px;
}

/* 3. 评论区文字颜色强制适配 */
.comment-content {
    color: var(--primary-text); /* 跟随主文字颜色(黑/白) */
}

/* 单独微调：如果你觉得评论内容太白了刺眼，可以用下面这行代替上面那行 */
/* .comment-content { color: var(--comment-text); } */

/* 4. 定义变量 (如果你之前的 ROOT 里没定义全，这里补个保险) */
:root {
    --comment-bg: #f7f7f7; /* 白天：浅灰 */
}

[data-theme="dark"] {
    --comment-bg: #202020; /* 黑夜：深黑灰 (比卡片背景稍亮一点点，显出层次) */
}
/* ========================================= */
/* 20. 修复：联系人页面 - 固定黑底不静止 (终极版) */
/* ========================================= */

/* 1. 先把原来容器的背景设为透明，避免重复 */
[data-theme="dark"] .app-container.has-custom-bg #contacts-tab-content {
    background-color: transparent !important;
    position: relative; /* 为伪元素定位做参照 */
    z-index: 1; /* 确保内容在伪元素上面 */
    padding-bottom: 20px;
}

/* 2. 【核心】创建一个“伪元素”充当固定的黑色玻璃板 */
/* 只要“联系人”页面显示，这个黑色层就显示 */
[data-theme="dark"] .app-container.has-custom-bg #contacts-tab-content::before {
    content: ""; /* 必须有内容才能显示 */
    
    /* 【关键】使用 fixed 定位，它是相对于手机屏幕定位的，所以不会随页面滚动 */
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* 黑色半透明 0.6 */
    background-color: rgba(0, 0, 0, 0.6); 
    
    /* 放在内容的后面 */
    z-index: -1; 
    
    /* 让点击事件穿透这层黑底，不影响你点后面的东西（虽然这里它是底层，不加也行，加了保险） */
    pointer-events: none; 
}

/* 3. 清理掉列表项自带的样式 */
[data-theme="dark"] .app-container.has-custom-bg .contact-menu-item,
[data-theme="dark"] .app-container.has-custom-bg .group-header,
[data-theme="dark"] .app-container.has-custom-bg .friend-item {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: none !important;
}

/* 4. 强制文字变白 */
[data-theme="dark"] .app-container.has-custom-bg .friend-name,
[data-theme="dark"] .app-container.has-custom-bg .group-title,
[data-theme="dark"] .app-container.has-custom-bg .contact-menu-item span {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: none !important;
}

/* 5. 副标题文字变白 */
[data-theme="dark"] .app-container.has-custom-bg .friend-status-text,
[data-theme="dark"] .app-container.has-custom-bg .group-count {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* 6. 按下效果 */
[data-theme="dark"] .app-container.has-custom-bg .friend-item:active,
[data-theme="dark"] .app-container.has-custom-bg .contact-menu-item:active {
    background-color: rgba(0, 0, 0, 0.2) !important;
}
/* ========================================= */
/* 21. 发送按钮禁用状态 (新增)                */
/* ========================================= */
.send-button:disabled,
.send-button.is-loading {
    background-color: #ccc !important; /* 变成灰色 */
    color: #666 !important;
    cursor: not-allowed; /* 鼠标变成禁止符号 */
    pointer-events: none; /* 禁止点击事件 */
}

/* ========================================= */
/* 22. 全局表单输入框增高 (修正版 - 80px)     */
/* ========================================= */

/* --- 1. 创建角色页 (身份、爱好、讨厌、姓名) --- */
/* 专门针对这些单行输入框 */
#view-create-role input {
    /* 这里改成了 80px，相当于在原基础(约30px)上增加了50px */
    height: 80px !important;    
    
    /* 配合高度，保证文字垂直居中 */
    line-height: 80px;          
    font-size: 18px;            /* 框大了，字号也可以微调大一点点 */
    padding: 0 5px;
}

/* --- 多行文本框保持之前的设置 (外貌、性格、背景) --- */
#view-create-role textarea {
    min-height: 150px !important; 
    padding-top: 20px;            /* 顶部留白也增加一点 */
    font-size: 18px;
    line-height: 1.6;
}

/* --- (可选) 如果你希望设置页的输入框也同步变大，把下面也改了 --- */
#settings-info-form input, 
#settings-info-form select,
.setup-group input, 
.setup-group select {
    height: 80px !important;
    line-height: 80px;
}
/* ========================================= */
/* 23. 修复身份/爱好/讨厌的换行和高度问题      */
/* ========================================= */

/* 这里专门选中我们刚刚修改的那三个 ID */
#role-identity,
#role-likes,
#role-dislikes {
    /* 1. 高度加高：平时只有20多，现在设为80px，符合你要求的“增加50px” */
    height: 80px !important;
    min-height: 80px !important;
    
    /* 2. 关键：允许换行 */
    white-space: pre-wrap;  /* 遇到边界自动换行 */
    overflow-y: hidden;     /* 如果字数很少，不显示滚动条 */
    
    /* 3. 样式微调 */
    padding-top: 10px;      /* 文字不要顶着上边框 */
    line-height: 1.5;       /* 增加行间距，不拥挤 */
    resize: none;           /* 去掉右下角的拖拽点 */
    font-size: 17px;        /* 字号 */
}

/* ========================================= */
/* 16. 移动端响应式 (重要修复：防遮挡布局)    */
/* ========================================= */
@media (max-width: 768px) {
    /* 1. 复位 Body 和 HTML，防止自带滚动 */
    body, html {
        display: block; 
        position: static; 
        background-color: var(--bg-color);
        /* 关键：确保 Body 本身就有底部留白，这里的 48px 对应 mobile-nav.js 里的 NAV_HEIGHT */
        padding-bottom: calc(48px + env(safe-area-inset-bottom)) !important;
        height: auto !important; /* 允许高度自动撑开 */
        min-height: 100vh;
    }
    
    /* 2. 核心容器高度控制：减去导航栏高度 */
    .app-container {
        width: 100vw; 
        max-width: none; 
        max-height: none;
        border-radius: 0; 
        box-shadow: none;
        
        /* 【关键修复】
           固定高度 = 视口高度(100dvh) - 底部导航高度(48px) - 安全距离
           这样整个APP的内容区域就会正好显示在导航栏上方 
        */
        height: calc(100dvh - 48px - env(safe-area-inset-bottom)) !important;
        
        position: fixed; /* 钉死位置 */
        top: 0;
        left: 0;
    }

    /* 3. 全屏子页面修正 */
    
    /* 【如果是聊天页面 & 全屏设置页】：我们需要它彻底全屏，覆盖底部 TabBar */
    #chat-view-container,
    .full-screen-page {
        height: auto !important; /* 禁用具体高度，依赖 top/bottom */
        top: 0;
        bottom: 50px !important;
    }

    /* 【如果是动态页面】：由于动态页可能不需要覆盖底部TabBar（看你设计），或者也全屏 */
    /* 这里为了保险，统一让所有全屏层都真的“全屏” */
    #view-feed-fullscreen {
        height: auto !important;
        top: 0;
        bottom: 0;
    }

    /* 4. 黑夜模式适配 */
    [data-theme="dark"] .app-header {
        border-bottom: none; 
        background-color: rgba(28, 28, 30, 0.9);
        backdrop-filter: blur(10px);
    }
    
    /* 5. 确保聊天输入框在最底部 */
    .chat-input-area {
        /* 如果有全面屏横条，输入框需要额外的下内边距，否则看起来很难受 */
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}
