/* 全局文字颜色：强制深色，确保在白色信封和黄色草稿纸上的绝对可读性 */
.rili-markdown-renderer,
.rili-markdown-renderer * {
    color: #1a1a1a !important;
    text-shadow: none !important;
}

/* 统一重置气泡基础属性，使其可以容纳越界的笔装饰 */
.group.is-user > div:first-child,
.group.is-assistant > div:first-child {
    position: relative !important;
    isolation: isolate !important;
    border-radius: 8px !important;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.06) !important;
    border: none !important;
    overflow: visible !important;
}

/* 核心彩蛋：在输入和输出框的右上角“别”上一支立体的校园风铅笔 */
.group.is-user > div:first-child::after,
.group.is-assistant > div:first-child::after {
    content: "" !important;
    position: absolute !important;
    top: -16px !important;
    right: 12px !important;
    width: 26px !important;
    height: 26px !important;
    /* 内联一支手绘感2B铅笔SVG */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FFD700' stroke='%23333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z'/%3E%3Cpath d='m15 5 4 4'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    z-index: 10 !important;
    filter: drop-shadow(2px 3px 2px rgba(0,0,0,0.15)) !important;
    transform: rotate(20deg) !important;
}

/* 用户输入框：白色信封效果（顶部带有经典的航空信件红蓝边缘） */
.group.is-user > div:first-child {
    background-color: #ffffff !important;
    padding-top: 24px !important; 
}
.group.is-user > div:first-child::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 4px !important;
    background: repeating-linear-gradient(45deg, #e74c3c, #e74c3c 12px, transparent 12px, transparent 24px, #3498db 24px, #3498db 36px, transparent 36px, transparent 48px) !important;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    z-index: -1 !important;
}

/* AI输出框：泛黄的草稿纸（带红色侧边距线与蓝色横向格线） */
.group.is-assistant > div:first-child {
    background-color: #fdfae8 !important;
    background-image: 
        linear-gradient(90deg, transparent 32px, rgba(231, 76, 60, 0.4) 32px, rgba(231, 76, 60, 0.4) 34px, transparent 34px),
        repeating-linear-gradient(180deg, transparent, transparent 27px, rgba(52, 152, 219, 0.15) 27px, rgba(52, 152, 219, 0.15) 28px) !important;
    background-position: top left !important;
    background-attachment: local !important;
    padding-left: 46px !important; /* 文字右移，避免压在红色边距线上 */
}

/* 底部元素状态联动：适配明亮背景，强制深色化小字与按钮 */
.text-xs.font-mono.text-muted-foreground {
    color: #777777 !important;
}
.bg-muted.rounded.flex {
    background-color: rgba(0, 0, 0, 0.04) !important;
}
.bg-muted.rounded.flex button svg.lucide {
    stroke: #555555 !important;
}
.group .md\:opacity-0 {
    opacity: 1 !important; /* 强制显示按钮区 */
}

/* 改造加载动画：隐藏原生三点跳动 */
.flex.gap-2.w-full.h-full.items-center.justify-center > span {
    display: none !important;
}

/* 定义青春文案的跳动帧动画 */
@keyframes youthLoading {
    0%, 100% { transform: translateY(0); color: #3498db; }
    50% { transform: translateY(-5px); color: #f1c40f; }
}

/* 注入自定义加载文字 */
.flex.gap-2.w-full.h-full.items-center.justify-center::before {
    content: "你的青春正在加载中..." !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 2px !important;
    color: #3498db !important;
    animation: youthLoading 1.2s infinite ease-in-out !important;
    display: block !important;
}

/* =========================================
   [心跳微动效补丁] 敏感词条的粉色脉冲发光
   ========================================= */
@keyframes heartPulse {
    0% { box-shadow: 0 0 0 0 rgba(251, 194, 235, 0.8); border-color: rgba(237, 137, 182, 1); }
    70% { box-shadow: 0 0 0 5px rgba(251, 194, 235, 0); border-color: rgba(251, 194, 235, 0.4); }
    100% { box-shadow: 0 0 0 0 rgba(251, 194, 235, 0); border-color: rgba(251, 194, 235, 0.4); }
}

xy z[h] {
    animation: heartPulse 2s infinite ease-in-out;
    color: #c44070;
    background: rgba(251, 194, 235, 0.4);
    border: 1px solid rgba(237, 137, 182, 0.8);
    position: relative;
    overflow: visible;
}
/* 增加微小的爱心伪元素装饰 */
xy z[h]::after {
    content: "♥";
    position: absolute;
    top: -6px;
    right: -5px;
    font-size: 9px;
    color: #ff6b9d;
    transform: rotate(15deg);
    opacity: 0.8;
}

/* 校园系统总容器 */
xy {
    display: block;
    font-family: 'PingFang SC', 'Helvetica Neue', sans-serif;
    color: #3d454d;
    background: #fcfcfd; 
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(150, 200, 251, 0.15);
    font-size: 14px;
    line-height: 1.6;
    margin: 5px 0;
}

/* 顶部状态栏：蓝粉渐变，玻璃质感 */
xy hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #96c8fb 0%, #fbc2eb 100%);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(251, 194, 235, 0.4);
}
xy hd span:not(:last-child)::after {
    content: "✦";
    margin: 0 10px;
    opacity: 0.6;
    font-size: 10px;
}

/* 正文小说区域：增加呼吸感与阅读舒适度 */
xy > p {
    margin: 12px 6px;
    text-indent: 2em;
    line-height: 1.7;
    color: #2c3e50;
}

/* 手账风折叠面板 */
xy details {
    background: #fff;
    border: 1px solid #edf1f7;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: all 0.3s;
}
xy summary {
    list-style: none;
    padding: 12px 14px;
    font-weight: bold;
    color: #5c7b9e;
    background: linear-gradient(to right, #f8fbff, #fff);
    cursor: pointer;
    border-left: 5px solid #96c8fb;
    user-select: none;
    font-size: 15px;
}
xy summary::-webkit-details-marker { display: none; }
xy details[open] summary {
    border-left: 5px solid #fbc2eb;
    border-bottom: 1px dashed #edf1f7;
    color: #d77fa1;
    background: linear-gradient(to right, #fff5fa, #fff);
}

/* 数据卡片模块：利用::before渲染小标题，省去额外标签 */
xy d {
    display: block;
    margin: 16px 10px 10px;
    padding: 16px 12px 8px;
    background: #fafbfc;
    border: 1px solid #f0f3f8;
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.01);
}
xy d::before {
    content: attr(t);
    position: absolute;
    top: -11px;
    left: 12px;
    background: linear-gradient(90deg, #8cbcf5, #b4d8fa);
    color: white;
    font-size: 12px;
    padding: 2px 12px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(140,188,245,0.4);
    letter-spacing: 0.5px;
    z-index: 1;
}
xy d[t*="NPC档案"]::before, xy d[t*="恋爱"]::before, xy d[t*="情"]::before {
    background: linear-gradient(90deg, #f3a3c9, #fbc2eb);
    box-shadow: 0 2px 5px rgba(243,163,201,0.4);
}

/* 卡片内部网格与信息流排版 */
xy d p {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin: 0 0 6px 0;
    padding-bottom: 6px;
    border-bottom: 1px dashed #f0f3f8;
    font-size: 13px;
}
xy d p:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 姓名特显 */
xy n {
    font-size: 16px;
    font-weight: 900;
    color: #5b93df;
    margin-right: 10px;
    text-shadow: 1px 1px 0px rgba(91, 147, 223, 0.15);
}

/* 标签词条：微透粉色，突出“私密身体数据”与青春日记感 */
xy z {
    background: rgba(251, 194, 235, 0.18);
    color: #c96b92;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    margin-right: 8px;
    margin-bottom: 4px;
    border: 1px solid rgba(251, 194, 235, 0.4);
    white-space: nowrap;
    font-weight: bold;
}

/* 字段值文本 */
xy v {
    color: #636e7b;
    flex: 1;
    min-width: 50%;
    line-height: 1.5;
}

/* 序号装饰 (记忆回廊与行动列表) */
xy i {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #96c8fb, #fbc2eb);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-style: normal;
    margin-right: 10px;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(251, 194, 235, 0.4);
}

/* 行动选项专属交互（选择直接放在details下而非d下的p） */
xy details > p {
    display: flex;
    align-items: center;
    margin: 6px 12px;
    padding: 10px;
    border-radius: 8px;
    background: #fdfdfd;
    border: 1px solid #f0f3f8;
    transition: all 0.2s ease;
    cursor: pointer;
}
xy details > p:hover {
    background: #f4f8ff;
    transform: translateX(4px);
    box-shadow: -3px 3px 8px rgba(150, 200, 251, 0.15);
    border-color: #c2e9fb;
}
xy details > p:hover v { color: #5b93df; font-weight: bold; }

/* =========================================
   [手机聊天气泡补丁] 仿真实微信UI
   ========================================= */
/* 隐藏微信原本的小标题和边框，打造全面屏聊天感 */
xy d[t*="微信"]::before { display: none; }
xy d[t*="微信"] {
    background: #f3f3f3; /* 微信聊天背景色 */
    border: none;
    padding: 16px 12px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.03);
}

/* 聊天行容器 */
xy d[t*="微信"] p {
    border: none;
    display: flex;
    align-items: flex-start;
    margin: 0 0 16px 0;
    padding: 0;
    flex-wrap: nowrap;
    line-height: 1.5;
}

/* 标签 <z> 改造为【正方形头像】 */
xy d[t*="微信"] z {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: linear-gradient(135deg, #a9c2e3, #8cbcf5);
    color: white;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    margin: 0 12px 0 0;
    border: none;
    white-space: normal;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: none; /* 屏蔽可能继承的动画 */
}

/* 标签 <v> 改造为【聊天气泡】 */
xy d[t*="微信"] v {
    background: #fff;
    padding: 9px 12px;
    border-radius: 8px;
    position: relative;
    color: #333;
    max-width: 70%;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    min-width: auto;
    word-break: break-all;
}

/* 左侧气泡小尾巴（别人发来的） */
xy d[t*="微信"] v::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 14px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid #fff;
}

/* 主角发出的消息反转排版（利用属性 p[me]） */
xy d[t*="微信"] p[me] {
    flex-direction: row-reverse;
}
xy d[t*="微信"] p[me] z {
    margin: 0 0 0 12px; /* 头像移到右边 */
    background: linear-gradient(135deg, #fbc2eb, #f3a3c9); /* 主角头像粉色调 */
}
xy d[t*="微信"] p[me] v {
    background: #95ec69; /* 经典的微信绿 */
}
/* 右侧气泡小尾巴（我发出的） */
xy d[t*="微信"] p[me] v::before {
    left: auto;
    right: -5px;
    border-right: none;
    border-left: 5px solid #95ec69;
}

/* =========================================
   [私密拼图补丁] 身体数据网格化高级排版
   ========================================= */
xy g {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 10px 0;
    padding: 8px;
    background: rgba(251, 194, 235, 0.05);
    border-radius: 10px;
    border: 1px dashed rgba(251, 194, 235, 0.5);
}
xy g div {
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(251,194,235,0.15);
    transition: transform 0.2s;
}
xy g div:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(237, 137, 182, 0.3);
}
xy g div z {
    align-self: flex-start;
    margin-bottom: 6px;
    font-size: 10px; /* 标签做得更精致小巧 */
}
xy g div v {
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    min-width: 100%;
}

/* =========================================
   [记忆相册补丁] 拍立得相片风的记忆回廊
   ========================================= */
/* 将原本的扁平列表改为相片样式 */
xy d[t*="记忆"] {
    background: #f4f6f9; /* 稍微深一点的背景衬托相片 */
}
xy d[t*="记忆"] p {
    background: #fff;
    border: 1px solid #e1e4e8;
    padding: 10px 10px 24px 10px; /* 底部留白，模仿拍立得 */
    border-radius: 2px;
    box-shadow: 2px 4px 8px rgba(0,0,0,0.06);
    margin: 12px 6px;
    transform: rotate(-1deg);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    border-bottom: none;
}
/* 交替倾斜角度，产生散落感 */
xy d[t*="记忆"] p:nth-child(even) {
    transform: rotate(1.5deg);
}
/* 悬停放大查看相片 */
xy d[t*="记忆"] p:hover {
    transform: scale(1.05) rotate(0);
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}
/* 拍立得底部的胶带装饰/文字留白区投影 */
xy d[t*="记忆"] p::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.02));
}

/* =========================================
   [情欲选项补丁] H/暧昧行动专属视觉
   ========================================= */
/* 带有 x 属性的选项，呈现情欲潮红感 */
xy details > p[x] {
    background: linear-gradient(to right, #fff, #fff0f5);
    border-color: #fbc2eb;
}
xy details > p[x] i {
    background: linear-gradient(135deg, #ff758c, #ff7eb3);
    box-shadow: 0 2px 6px rgba(255, 117, 140, 0.4);
}
xy details > p[x] v {
    color: #c44070;
}
/* 悬停时的心跳红光霓虹反馈 */
xy details > p[x]:hover {
    background: #fff5fa;
    border-color: #ff7eb3;
    box-shadow: -3px 3px 12px rgba(255, 126, 179, 0.3);
}
xy details > p[x]::after {
    content: "💋";
    margin-left: auto;
    opacity: 0.6;
    font-size: 12px;
    filter: drop-shadow(0 0 2px rgba(255,117,140,0.5));
}