/* ========================================
   [血色胁迫 2.0] 深度沉浸聊天框美化
   修复文本对比度，新增情色动作震动特效与深色滤镜
======================================== */

/* ========================================
   1. 基础排版与强制高对比度文字
======================================== */
.group.is-user > div:first-child .rili-markdown-renderer,
.group.is-user > div:first-child .rili-markdown-renderer *,
.group.is-assistant > div:first-child .rili-markdown-renderer,
.group.is-assistant > div:first-child .rili-markdown-renderer * {
    color: #f0f0f5 !important; /* 采用偏冷的灰白色，比纯白更柔和，绝对清晰 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
    line-height: 1.8 !important;
    letter-spacing: 0.5px !important;
}

/* ========================================
   2. 玩家 (User) 输入框：绝对掌控者
======================================== */
.group.is-user > div:first-child {
    background: linear-gradient(135deg, #18181f 0%, #2a161b 100%) !important;
    border: 1px solid #ff2a55 !important;
    box-shadow: 0 4px 15px rgba(255, 42, 85, 0.2), inset 0 0 15px rgba(0, 0, 0, 0.8) !important;
    border-radius: 12px 0 12px 12px !important;
    position: relative !important;
    overflow: hidden !important;
}

/* ========================================
   3. 苏宁老师 (Assistant) 输出框：深渊与囚笼
   【修复可读性】：将背景彻底压暗为半透明黑红色，使灰白字体对比度拉满
======================================== */
.group.is-assistant > div:first-child {
    background: rgba(20, 10, 15, 0.85) !important; /* 极暗的黑红色背景 */
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px dashed rgba(255, 42, 85, 0.4) !important; /* 脆弱的虚线防线 */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
    border-radius: 0 12px 12px 12px !important;
}

/* ========================================
   4. 【核心玩法增强】动作与喘息描写的物理微颤
   捕捉被 *包裹* 的斜体字，将其变为粉色并施加震动，强化H向描写的感官刺激
======================================== */
.group.is-assistant > div:first-child .rili-markdown-renderer em {
    color: #ff7b9c !important; /* 淫靡的粉色高光 */
    font-style: normal !important;
    display: inline-block !important;
    font-weight: 500 !important;
    text-shadow: 0 0 8px rgba(255, 123, 156, 0.4) !important;
    animation: pleasureShiver 0.15s infinite alternate !important; /* 物理微颤 */
}
@keyframes pleasureShiver {
    0% { transform: translate(0px, 0px); }
    100% { transform: translate(0.5px, -0.5px); }
}

/* ========================================
   5. 全局沉浸细节：光标选中色、底栏伪装、头像污染
======================================== */
/* 鼠标选中文字时的背景色变为血色 */
::selection {
    background: rgba(255, 42, 85, 0.4) !important;
    color: #fff !important;
}

/* AI头像污染：加上暗红发光与轻度模糊，象征理智沦丧（若平台有头像） */
.group.is-assistant .avatar-container, 
.group.is-assistant img.rounded-full {
    filter: drop-shadow(0 0 5px rgba(255, 42, 85, 0.6)) brightness(0.8) contrast(1.2) !important;
    border: 1px solid rgba(255, 42, 85, 0.5) !important;
}

/* 底部操作按钮与消耗数字：融入黑夜 */
.text-xs.font-mono.text-muted-foreground {
    color: rgba(255, 255, 255, 0.4) !important;
}
.group .md\:opacity-0 {
    opacity: 1 !important; 
}
.bg-muted.rounded.flex {
    background: rgba(15, 15, 20, 0.8) !important;
    border: 1px solid rgba(255, 42, 85, 0.2) !important;
}
.bg-muted.rounded.flex button svg.lucide {
    color: rgba(255, 42, 85, 0.6) !important;
    stroke: rgba(255, 42, 85, 0.6) !important;
    transition: all 0.2s ease !important;
}
.bg-muted.rounded.flex button:hover svg.lucide {
    stroke: #ff2a55 !important;
    filter: drop-shadow(0 0 5px rgba(255,42,85,0.8)) !important;
    transform: scale(1.1) !important;
}

/* ========================================
   6. 加载动画：惶恐的心跳
======================================== */
.flex.gap-2.w-full.h-full.items-center.justify-center > span {
    display: none !important;
}
.flex.gap-2.w-full.h-full.items-center.justify-center {
    position: relative !important;
}
.flex.gap-2.w-full.h-full.items-center.justify-center::before {
    content: "" !important;
    width: 24px !important;
    height: 24px !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff2a55' stroke='%23ff2a55' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><path d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'></path></svg>") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    animation: panicHeartbeat 0.5s infinite alternate cubic-bezier(0.25, 0.1, 0.25, 1) !important;
    filter: drop-shadow(0 0 8px rgba(255, 42, 85, 0.9)) !important;
}
@keyframes panicHeartbeat {
    0% { transform: scale(0.85); opacity: 0.5; }
    100% { transform: scale(1.2); opacity: 1; }
}

/* 基础容器：泛黄的旧试卷 / 私密日记本风 */
ai {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* 将主背景改为暖黄色/泛黄纸张色 */
  --bg-paper: #fdf1d6; 
  --text-main: #4a3f35; /* 字体颜色调为深褐色，搭配黄底更柔和 */
  --line-blue: #9abdbd;
  --pure-pink: #f1a9c4;
  --lust-purple: #9b59b6;
  --wet-blue: #7fb3d5;
  
  background: var(--bg-paper);
  color: var(--text-main);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border: 1px solid #e8d8b8;
  /* 泛黄试卷的网格纹理 */
  background-image: linear-gradient(var(--bg-paper) 90%, #f4e4c1 100%);
  background-size: 100% 25px;
  font-size: 14px;
  line-height: 1.5;
}

/* 顶部状态条：黑板粉笔/笔记本横条 */
ai hd {
  display: block;
  background: #3e362e; /* 配合黄纸，改为深咖/黑板色 */
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px 6px 0 0;
  font-size: 12.5px;
  font-weight: bold;
  letter-spacing: 1px;
  border-bottom: 3px solid var(--line-blue);
  margin: -10px -10px 10px -10px;
}

/* 折叠面板统一样式：微透的暖黄底色 */
ai details {
  background: rgba(255, 252, 245, 0.85);
  border: 1px solid #ebdcb7;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.3s;
}
ai details[open] {
  border-color: var(--pure-pink);
  box-shadow: 0 2px 8px rgba(241, 169, 196, 0.2);
}

/* 标题样式：大题题号感 */
ai summary {
  padding: 8px 12px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(244, 228, 193, 0.4);
  border-bottom: 1px dashed #dcb899;
  list-style: none; /* 隐藏默认箭头 */
  color: #4a3f35;
  display: flex;
  align-items: center;
}
ai summary::-webkit-details-marker { display: none; }
ai summary::before {
  content: "🖊️";
  margin-right: 6px;
  font-size: 12px;
}
ai details[open] summary {
  /* 展开后，从暖黄过渡到微微透出情欲的粉色 */
  background: linear-gradient(135deg, rgba(255,252,245,0.8) 0%, rgba(243,230,232,0.8) 100%); 
}

/* 基础属性双列排布 */
ai u1, ai u2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  padding: 8px;
}
ai d {
  display: block;
  background: #fffcf5; /* 避免刺眼的纯白，改用极淡的米白 */
  border: 1px solid #ebdcb7;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  border-left: 3px solid var(--line-blue);
}

/* 数值条：纯爱、恶堕、发情 */
ai bar {
  display: block;
  grid-column: 1 / -1;
  padding: 4px 10px;
  border-radius: 20px;
  color: #fff;
  font-weight: bold;
  font-size: 12.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
ai bar[c="p"] { background: linear-gradient(90deg, var(--pure-pink) 0%, #f6cbd9 100%); }
ai bar[c="d"] { background: linear-gradient(90deg, var(--lust-purple) 0%, #b273d2 100%); }
ai bar[c="l"] {
  background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%);
  animation: pulseBg 2s infinite alternate; /* 发情度呼吸动效 */
}

/* 👙 暗藏玩具专属栏 (核心反差元素) */
@keyframes vibrate {
  0% { transform: translate(0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(0); }
}
ai eq {
  display: block;
  grid-column: 1 / -1;
  background: rgba(155, 89, 182, 0.05);
  border: 1px dashed var(--lust-purple);
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--lust-purple);
  font-weight: 600;
  font-size: 13.5px;
  /* 隐秘的蕾丝网点背景 */
  background-image: radial-gradient(rgba(155, 89, 182, 0.25) 1px, transparent 1px);
  background-size: 8px 8px;
}
ai eq:hover {
  animation: vibrate 0.2s infinite; /* Hover时模拟跳蛋震动反馈 */
  background-color: rgba(155, 89, 182, 0.15);
}

/* 身体雷达区 */
ai bd {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 4px;
  padding: 6px 8px;
  background: #fdf5e6;
  border-top: 1px solid #ebdcb7;
}
ai bd p {
  margin: 0;
  padding: 4px 6px;
  background: #fffcf5;
  border: 1px solid #f2e2ce;
  border-radius: 4px;
  font-size: 12.5px;
  color: #5c4d3c;
}

/* 💦 体液与高潮统计 (湿润荧光效) */
ai sts {
  display: block;
  grid-column: 1 / -1;
  text-align: center;
  /* 在黄底上，水渍的蓝色会更有质感 */
  background: linear-gradient(135deg, rgba(127,179,213,0.15), rgba(241,169,196,0.15));
  border: 1px solid var(--wet-blue);
  color: #2471a3;
  padding: 6px;
  margin: 4px 8px 8px 8px;
  border-radius: 4px;
  font-weight: bold;
  box-shadow: inset 0 0 8px rgba(127,179,213,0.25);
}

/* 🌌 记忆回廊时间轴 */
ai mem {
  display: block;
  padding: 8px;
  border-left: 2px solid #dcb899;
  margin: 8px 16px;
}
ai mem::before {
  content: attr(t);
  display: block;
  font-size: 12px;
  color: #8c7a6b;
  margin-bottom: 6px;
}
ai m {
  display: block;
  position: relative;
  background: #fffcf5;
  border: 1px solid #ebdcb7;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-size: 12.5px;
}
ai m::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--line-blue);
  border-radius: 50%;
}
ai m b { color: #d35400; margin-right: 4px; font-weight: normal;}
ai m s { color: #16a085; margin-right: 4px; text-decoration: none; font-weight: bold;}
ai m e { color: #4a3f35; }

/* 🎯 课后选项：试卷选择题风 */
ai ops {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 252, 245, 0.5);
}
ai o {
  display: block;
  padding: 6px 10px;
  border: 1px solid #ebdcb7;
  border-radius: 4px;
  background: #fffcf5;
  transition: 0.2s;
  cursor: pointer;
  position: relative;
  padding-left: 30px;
}
ai o::before {
  content: "⭕";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.3;
}
ai o:hover {
  background: #fdf0f4;
  border-color: var(--pure-pink);
  transform: translateX(4px);
}
ai o:hover::before {
  content: "✅";
  opacity: 1;
}

/* 动效 */
@keyframes pulseBg {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.1); box-shadow: 0 0 8px rgba(255, 117, 140, 0.4); }
}