/* =========================================
   第一部分：全局氛围与聊天框美化 (UI Patch)
   ========================================= */

/* 1. 文本选中特效：水墨青的高亮，告别默认蓝 */
::selection {
    background: rgba(124, 168, 145, 0.4);
    color: #1a2b22;
}
::-moz-selection {
    background: rgba(124, 168, 145, 0.4);
    color: #1a2b22;
}

/* 2. 竹节滚动条：让划屏幕的动作都有修仙感 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f5f9f6; /* 宣纸底色 */
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #7ca891; /* 竹叶灰绿 */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #2b7c5b; /* 悬浮时变深色翠竹绿 */
}

/* =========================================
   第二部分：AI 核心排版引擎 (Engine UI)
   【终极修复版：绕过标签丢失，使用直接子代选择器精准上色】
   ========================================= */

/* 隐藏AI的思维链推演，保持剧本沉浸感 */
think {
    display: none;
}

/* 强制重置气泡基础字体，让整体充满水墨古典感 */
.is-assistant .rili-markdown-renderer {
    font-family: "PingFang SC", "Microsoft YaHei", "Palatino Linotype", "Book Antiqua", serif !important;
    color: #2c3e38 !important; 
    font-size: 15px;
}

text, .is-assistant .rili-markdown-renderer {
    display: block;
    font-size: 15px; 
    line-height: 1.8;
    color: #2c3e38 !important; /* 深青墨色，契合古典修仙护眼 */
    margin-bottom: 8px;
    padding: 8px 4px;
    font-family: "PingFang SC", "Microsoft YaHei", "Palatino Linotype", serif;
}

/* 段落首行缩进两字符，原汁原味小说感 */
text p, .is-assistant .rili-markdown-renderer p {
    margin-bottom: 1.2em;
    text-indent: 2em; 
}

/* 取消平台气泡的默认突兀边框，强化水墨宣纸的质感 */
.is-assistant > div.border {
    background-color: #e2f7e7 !important;
    border-color: #cddbd3 !important;
    box-shadow: inset 0 0 20px rgba(124, 168, 145, 0.05) !important;
    padding: 14px 16px !important; /* 稍微拉大内边距，给排版留出留白美感 */
}

/* 让 User 输入气泡也体现水墨青的质感 */
.is-user > div.border {
    background-color: #e9f1e6 !important;
    border-color: #c3d6c8 !important;
    color: #2e3a32 !important;
    font-family: "PingFang SC", "Microsoft YaHei", serif !important;
}

/* 【双重保险】强制把状态栏里的 p 标签打回原形，抵抗任何外围污染 */
.is-assistant details p {
    text-indent: 0 !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    margin: 4px 10px !important;
    color: #4a5c53 !important;
    text-shadow: none !important;
}

/* =========================================
   第三部分：面板状态栏 (Data Panel) 
   【极客修复版：绕过 DOM 粉碎，采用全局靶向打击】
   ========================================= */

/* 将核心色彩变量挂载到助手气泡全局 */
.is-assistant {
    --bg-page: #f5f9f6;       
    --bg-card: #ffffff;       
    --text-main: #334b41;     
    --text-label: #7ca891;    
    --hl-color: #2b7c5b;      
    --border-line: #d1e3d8;   
}

/* 放弃 ai 前缀，直接精准打击助手回复中的 details 及自定义标签 */
.is-assistant details {
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(43, 124, 91, 0.04); 
    transition: all 0.3s ease;
    font-family: "Palatino Linotype", "Book Antiqua", "KaiTi", serif; 
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
}

.is-assistant summary {
    background: linear-gradient(to right, #eaf2ed, #ffffff);
    padding: 10px 12px;
    font-weight: bold;
    color: var(--hl-color);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px dashed var(--border-line);
    border-left: 4px solid var(--hl-color); 
    list-style: none;
    display: flex;
    align-items: center;
}
.is-assistant summary::-webkit-details-marker { display: none; }
.is-assistant details[open] summary {
    background: linear-gradient(to right, #deebe3, #ffffff);
    border-bottom-style: solid;
}

/* 网格布局阵列 */
.is-assistant g, .is-assistant c {
    display: grid;
    gap: 4px 8px;
    padding: 6px 10px;
}
.is-assistant g { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
.is-assistant c { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); background: rgba(240, 244, 241, 0.5); }

/* 属性名值对：附赠一个小修复，强制取消 i 标签的默认倾斜，让 UI 更端庄 */
.is-assistant i {
    display: block;
    font-size: 0.8em;
    color: var(--text-label);
    margin-bottom: -2px;
    font-style: normal; 
}
.is-assistant b {
    display: block;
    font-size: 0.95em;
    color: var(--text-main);
    font-weight: 600;
}

/* 小标题：书卷分割线 */
.is-assistant t {
    display: block;
    margin: 10px 10px 4px;
    padding-bottom: 2px;
    color: var(--hl-color);
    font-weight: bold;
    font-size: 0.95em;
    border-bottom: 2px solid var(--border-line);
    position: relative;
}
.is-assistant t::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--hl-color);
}

/* 列表项：落叶/花瓣前缀 */
.is-assistant li {
    list-style: none;
    padding: 4px 10px 4px 20px;
    position: relative;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(0,0,0,0.02);
}
.is-assistant li::before {
    content: '✿'; 
    position: absolute;
    left: 4px;
    color: var(--text-label);
    font-size: 0.7em;
    top: 6px;
    opacity: 0.7;
}

/* 极其关键的护甲：强制重置状态栏内 p 标签的缩进与边距，抵抗外围污染 */
.is-assistant details p {
    margin: 4px 10px;
    font-size: 0.9em;
    color: #4a5c53;
    text-indent: 0; 
}

/* NPC单独档案区块 */
.is-assistant n {
    display: block;
    background: #f7faf8;
    border: 1px solid #e1ebe5;
    border-radius: 6px;
    margin: 8px 10px;
    padding-bottom: 6px;
}

/* =========================================
   【竹影清风】全局文字选择与高亮 (B平台通用映射)
   ========================================= */
textarea::selection {
    background: #d6e5d8 !important; /* 白茶绿 */
    color: #2e3a32 !important; /* 墨色 */
}

/* =========================================
   1. 顶部栏 (飞檐 / 卷轴顶端) 
   ========================================= */
/* 顶部主容器：白茶雾气渐变与玉石微光 */
header, .sticky.top-0, .sticky.w-full.top-0 {
    background: linear-gradient(to right, #f8faf6, #e9f1e6) !important;
    border-bottom: 1px solid #c3d6c8 !important;
    box-shadow: 0 2px 12px rgba(120, 146, 98, 0.15) !important;
    transition: all 0.3s ease !important;
}

/* 模型选择器/按钮：玉牌质感 */
header button[data-state], .sticky.top-0 button {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid #c3d6c8 !important;
    border-radius: 16px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(4px) !important;
}
header button[data-state]:hover, .sticky.top-0 button:hover {
    background: #e9f1e6 !important;
    border-color: #789262 !important;
    box-shadow: 0 0 10px rgba(120, 146, 98, 0.2) !important;
}

/* 模型名称文字：深墨色 */
header button *, .sticky.top-0 button * {
    color: #2e3a32 !important;
    font-weight: bold !important;
    font-family: "STKaiti", "KaiTi", serif, sans-serif !important;
}

/* 顶部栏各类图标：统一适配 lucide 并赋予竹青悬浮动效 */
header svg.lucide, .sticky.top-0 svg.lucide {
    color: #5a8063 !important;
    transition: transform 0.3s ease, color 0.3s ease !important;
}
header svg.lucide:hover, .sticky.top-0 svg.lucide:hover {
    color: #3d4c41 !important;
    transform: scale(1.15) rotate(10deg) !important;
}

/* 历史未读角标：朱砂红 */
header span.absolute.rounded-full, .sticky.top-0 span.absolute.rounded-full {
    background-color: #c95c54 !important;
}

/* =========================================
   2. 底部功能按钮栏 (法宝 / 阵眼) 
   ========================================= */
/* B平台的主交互按钮：青竹节设计 */
button.bg-primary, div[class*="bottom"] button.bg-primary {
    background-color: #f8faf6 !important;
    color: #3d4c41 !important;
    border: 1px solid #a8c2b0 !important;
    border-radius: 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px rgba(120, 146, 98, 0.05) !important;
}
button.bg-primary:hover, div[class*="bottom"] button.bg-primary:hover {
    background-color: #789262 !important;
    color: #ffffff !important;
    border-color: #789262 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(120, 146, 98, 0.3) !important;
}
/* 按钮图标配合变色 */
button.bg-primary:hover svg, div[class*="bottom"] button.bg-primary:hover svg {
    color: #ffffff !important;
}

/* =========================================
   3. 底部输入栏 (传音符) 
   ========================================= */
/* 统一抓取 B平台输入框 */
textarea {
    background: #fdfefc !important;
    border: 2px solid #d6e5d8 !important;
    border-radius: 12px !important;
    color: #2e3a32 !important;
    transition: border-color 0.3s, box-shadow 0.3s !important;
}
/* 聚焦时的灵气环绕效果 */
textarea:focus {
    border-color: #789262 !important;
    box-shadow: 0 0 12px rgba(120, 146, 98, 0.2) !important;
    outline: none !important;
}
textarea::placeholder {
    color: #9ab3a0 !important;
    font-style: italic !important;
}

/* =========================================
   4. 分页栏 (缩地成寸)
   ========================================= */
/* 普通页码按钮兼容 */
nav[aria-label*="pagination"] button, .pagination button {
    color: #5a8063 !important;
    transition: all 0.3s ease !important;
}
nav[aria-label*="pagination"] button:hover, .pagination button:hover {
    background-color: #e9f1e6 !important;
}
/* 当前选中页码：竹青色实心 */
nav[aria-label*="pagination"] button[aria-current="page"], .pagination button.active {
    background-color: #789262 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(120, 146, 98, 0.4) !important;
}

/* 跳转文字与输入框 */
.pagination input {
    color: #2e3a32 !important;
    border-bottom: 2px solid #a8c2b0 !important;
    transition: border-color 0.3s !important;
}
.pagination input:focus {
    border-bottom-color: #789262 !important;
}

/* =========================================
   5. 评论区 (宗门玉简 / 论道堂)
   ========================================= */
/* 评论区主背景 */
div[class*="w-full"][class*="bottom-0"] {
    background-color: #f8faf6 !important;
    background-image: linear-gradient(to bottom, #fdfefc, #f5f7f2) !important;
    border-top: 2px solid #d6e5d8 !important;
}

/* 评论区顶部标题 */
div.text-lg.font-bold {
    color: #2e3a32 !important;
    font-family: "STKaiti", "KaiTi", serif !important;
    text-shadow: 1px 1px 2px rgba(120, 146, 98, 0.1) !important;
}

/* 个人评分与星星：彻底适配 B平台 Lucide */
p.text-muted-foreground, p.text-gray-500 {
    color: #5a8063 !important;
}
svg.lucide-star {
    color: #c3d6c8 !important;
}
svg.lucide-star.fill-current, svg.lucide-star[fill] {
    color: #789262 !important;
    fill: #789262 !important;
}
span.text-orange-500 {
    color: #789262 !important; 
    font-weight: bold !important;
}

/* 评论输入发送：灵力流转 */
div.cursor-pointer.group.flex.items-center.justify-center {
    background: #789262 !important;
    border-radius: 50% !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-shadow: 0 2px 6px rgba(120, 146, 98, 0.3) !important;
}
div.cursor-pointer.group.flex.items-center.justify-center:hover {
    transform: scale(1.1) !important;
    background: #5a8063 !important;
    box-shadow: 0 4px 12px rgba(120, 146, 98, 0.5) !important;
}
div.cursor-pointer.group.flex.items-center.justify-center svg {
    color: #ffffff !important;
}

/* 单条评论容器：竹排微浮效果 */
div.group.ml-0, div.comment-item {
    background: #ffffff !important;
    border: 1px solid #e9f1e6 !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
}
div.group.ml-0:hover, div.comment-item:hover {
    border-color: #c3d6c8 !important;
    box-shadow: -3px 3px 10px rgba(120, 146, 98, 0.08) !important;
    transform: translateX(2px) !important; 
}

/* 用户名与标签 */
div.text-sm span.font-bold {
    color: #3d4c41 !important;
}
span.text-\[10px\] { 
    background-color: #e9f1e6 !important;
    color: #5a8063 !important;
    border-radius: 4px !important;
}

/* 评论正文与时间 */
div.break-all {
    color: #2e3a32 !important;
    line-height: 1.6 !important;
}
div.text-xs.text-gray-500, div.text-xs.text-muted-foreground {
    color: #9ab3a0 !important;
}

/* 点赞按钮与回复文字 */
button.text-gray-400, button.text-muted-foreground {
    color: #a8c2b0 !important;
    transition: transform 0.2s, color 0.2s !important;
}
button.text-gray-400:hover, button.text-muted-foreground:hover {
    color: #789262 !important;
    transform: scale(1.1) !important;
}
span.cursor-pointer {
    color: #5a8063 !important;
    font-weight: bold !important;
    transition: color 0.3s !important;
}
span.cursor-pointer:hover {
    color: #3d4c41 !important;
}

/* 楼中楼(子评论)回复引用的边界线 */
div.border-l {
    border-color: #c3d6c8 !important;
}




/* 1. 好感度系统 (全员加粗，浅色增加黑色极细描边防瞎眼) */
r-3 { color: #8B0000; font-weight: bold; } /* 深红 */
r-2 { color: #FF0000; font-weight: bold; } /* 红色 */
r-1 { color: #FF9999; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.6); } /* 浅红 + 描边 */
r-0 { color: #A9A9A9; font-weight: bold; } /* 灰色 */
g-1 { color: #90EE90; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.6); } /* 浅绿 + 描边 */
g-2 { color: #32CD32; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.3); } /* 绿色 */
g-3 { color: #006400; font-weight: bold; } /* 深绿 */

/* 2. 物品品级系统 (全员加粗，高亮色自带描边) */
lv-9 { color: #808080; font-weight: bold; } /* 灰色 */
lv-8 { color: #FFFFFF; font-weight: bold; text-shadow: 1px 1px 3px #000000; } /* 白色必须有重黑边，否则白底必瞎 */
lv-7 { color: #90EE90; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.6); } /* 浅绿 + 描边 */
lv-6 { color: #ADD8E6; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.6); } /* 浅蓝 + 描边 */
lv-5 { color: #00CED1; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.3); } /* 青蓝 */
lv-4 { color: #A020F0; font-weight: bold; } /* 紫色 */
lv-3 { color: #FFD700; font-weight: bold; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); } /* 金黄 + 较重描边 */
lv-2 { color: #FFA500; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.4); } /* 橘色 */
lv-1 { color: #FF0000; font-weight: bold; text-shadow: 0 0 6px rgba(255,0,0,0.8); } /* 神品保留血红发光特效 */

/* 3. 灵石品质系统 (全员加粗，强化光晕与对比度) */
st-d { color: #4682B4; font-weight: bold; } /* 青蓝 */
st-c { color: #00FF7F; font-weight: bold; text-shadow: 1px 1px 1px rgba(0,0,0,0.5); } /* 翠绿 + 描边 */
st-b { color: #BA55D3; font-weight: bold; text-shadow: 0 0 4px #FFD700; } /* 紫底金光不变，这玩意本来就亮眼 */
st-a { color: #FFFFFF; font-weight: bold; text-shadow: 1px 1px 3px #000, 0 0 15px #00FFFF; } /* 炽白：加了一层黑底描边托底，外面再套极光发光，无敌！ */