/* ═══ B平台按钮组保护（自动注入 — 防止按钮消失）═══
   原理：B平台消息操作按钮结构为：
   .flex.items-center.gap-1.ml-auto (hover显隐包装)
     └── .bg-muted.rounded.flex.p-0.5 (按钮组容器)
           └── button.rounded-full.size-7 (单个按钮)
   以下规则使用高specificity + !important确保按钮
   不被任何转换后/透传的CSS规则意外隐藏
   ═══════════════════════════════════════════════ */
/* 按钮组容器保护 */
.w-full.h-full.flex.group .bg-muted.rounded.flex.p-0\.5,
.is-user .bg-muted.rounded.flex.p-0\.5,
.is-assistant .bg-muted.rounded.flex.p-0\.5 {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: visible !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  pointer-events: auto !important;
  clip: auto !important;
  clip-path: none !important;
}
/* 单个按钮保护 */
.w-full.h-full.flex.group .bg-muted.rounded.flex.p-0\.5 > button,
.is-user .bg-muted.rounded.flex.p-0\.5 > button,
.is-assistant .bg-muted.rounded.flex.p-0\.5 > button {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: relative !important;
  clip: auto !important;
  clip-path: none !important;
}
/* hover显隐包装层保护 — 仅保留B平台原生的opacity过渡 */
.flex.items-center.gap-1.ml-auto.md\:opacity-0.group-hover\:opacity-100 {
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  overflow: visible !important;
}
/* 操作行保护 */
.flex.w-full.items-center.justify-between.gap-2.px-2 {
  display: flex !important;
  visibility: visible !important;
  overflow: visible !important;
}

/* ===================== 【莫皙 · 纯爱聊天框】 ===================== */
/* 主题：深蓝渐变 · 月光清冷 · 文字璀璨 */

/* --- 1. 整体聊天框容器（莫皙每一条消息） --- */
ai {
    display: block;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    
    /* 深色渐变背景，模拟月光下的清冷感 */
    background: linear-gradient(145deg, #1a1f2e 0%, #141824 100%);
    border: none;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    padding: 16px 20px;
    margin: 8px 0;
    
    /* 强制所有直接文本为明亮色，确保可读性 */
    color: #f0f3ff !important;
    font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
    line-height: 1.7;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --- 2. 背景氛围光晕（伪元素，位于文字下方） --- */
ai::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(180, 195, 255, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* 让内部所有内容层叠在光晕之上 */
ai > * {
    position: relative;
    z-index: 1;
}

/* --- 3. 头部信息（时间・地点・天气） --- */
ai hd {
    display: block;
    padding: 0 0 8px 0;
    font-size: 15px;
    font-weight: 700;
    color: #b8c6ff;  /* 淡蓝色，与深色背景对比 */
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

ai hd::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #8096ff;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 0 8px #8096ff;
}

/* --- 4. details 折叠面板（状态栏的每一块） --- */
ai details {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin: 6px 0;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.25s ease;
}

ai details:hover {
    border-color: rgba(128,150,255,0.3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

ai details[open] {
    padding-bottom: 6px;
}

/* --- 5. summary 标题（如"🧑 主角""🤍 莫皙"等） --- */
ai summary {
    font-size: 14px;
    font-weight: 600;
    color: #d4dfff;
    cursor: pointer;
    padding: 2px 0 2px 24px;
    position: relative;
    list-style: none;
    user-select: none;
}

ai summary::-webkit-details-marker {
    display: none;
}

ai summary::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8096ff;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}

ai details[open] > summary::before {
    opacity: 0.8;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 10px #8096ff;
}

/* --- 6. 内部字段样式 --- */
ai f {
    font-weight: 700;
    color: #e6eeff;
    font-size: 14px;
    display: inline-block;
    position: relative;
    margin-right: 4px;
}

ai f::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #8096ff, transparent);
    border-radius: 1px;
}

ai d {
    display: inline-block;
    font-size: 13px;
    color: #d0d8f0;
    background: rgba(128,150,255,0.08);
    padding: 1px 8px;
    border-radius: 4px;
    line-height: 1.6;
    margin: 1px 2px;
    white-space: nowrap;
}

ai t {
    display: inline-block;
    font-weight: 600;
    font-size: 13px;
    color: #8096ff;
    margin-right: 4px;
    letter-spacing: 0.3px;
}

ai t::before {
    content: '◆';
    font-size: 10px;
    margin-right: 4px;
    color: #8096ff;
    opacity: 0.6;
}

/* --- 7. 状态条 bar --- */
ai bar {
    display: inline-flex;
    align-items: center;
    height: 8px;
    width: 60px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
    margin: 0 4px 0 2px;
    position: relative;
}

ai bar::before {
    content: '';
    display: block;
    height: 100%;
    width: calc( var(--r, 50) * 1% ); /* 在HTML中使用 r 属性，如 <bar r="80"> */
    background: linear-gradient(90deg, #3aa, #8096ff);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

/* --- 8. 文本区 p 内排列 --- */
ai p {
    margin: 4px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
}

/* --- 9. 小字 sub（记忆区提示） --- */
ai sub {
    display: block;
    font-size: 11px;
    color: #8896a6;
    font-style: italic;
    margin-top: 6px;
    padding-left: 6px;
    border-left: 2px solid rgba(255,255,255,0.1);
}

/* --- 10. 行动推荐中 d 的hover效果 --- */
ai details:last-child d {
    cursor: pointer;
    transition: all 0.2s;
}

ai details:last-child d:hover {
    background: rgba(128,150,255,0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* --- 11. 移动端适配 --- */
@media (max-width: 480px) {
    ai {
        padding: 12px 14px;
        font-size: 13px;
    }
    ai hd {
        font-size: 14px;
    }
    ai d, ai t {
        font-size: 12px;
        white-space: normal; /* 允许换行，避免溢出 */
    }
    ai bar {
        width: 48px;
        height: 6px;
    }
    ai details {
        padding: 6px 8px;
    }
}

/* ===================== 美化结束 ===================== */