/* 1. 隐藏平台默认的顶部颜色装饰条 */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 2. 统一聊天框主体美化：羊皮纸卷宗质感 */
.bg-gray-100\/90.relative.inline-block {
    background: linear-gradient(135deg, #fdf6e3 0%, #f4e8d1 50%, #e8d5b5 100%) !important;
    border: 2px solid #b89947 !important;
    border-radius: 8px !important;
    box-shadow: inset 0 0 20px rgba(139, 69, 19, 0.1), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    padding: 16px !important;
    backdrop-filter: none !important; /* 移除毛玻璃，强调实体纸张感 */
}

/* 3. 主文本样式：深棕色墨水，绝对确保可读性 */
.bg-gray-100\/90.relative.inline-block .markdown-body {
    color: #3e2723 !important;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif, system-ui !important;
    font-weight: 500 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    text-shadow: none !important; /* 绝对禁止文本阴影以保证清晰 */
    background: transparent !important;
    z-index: 1 !important;
}

/* 4. 底部附加元素美化 (按钮、模型名称、Token消耗) */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary,
.MuiTypography-root.MuiTypography-body2.css-6c0gf2,
.text-orange-500 {
    color: #8b4513 !important; /* 铁锈红/暗棕色 */
    font-weight: bold !important;
    transition: all 0.3s ease !important;
}

/* 按钮悬停效果 */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary:hover {
    background-color: rgba(139, 69, 19, 0.1) !important;
    color: #9d0208 !important; /* 悬停变为帝国红 */
}

/* =========================================================
   5. 巨大的“帝国全视之眼”魔法阵加载动画 (核心定制)
   ========================================================= */

/* 隐藏默认的闪烁小圆点 */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}

/* 改造加载动画的父容器，使其变得巨大并居中 */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    width: 100% !important; /* 占满聊天框宽度 */
    height: 140px !important; /* 巨大的高度空间 */
    background: transparent !important;
    margin: 10px 0 !important;
}

/* 注入基于 SVG SMIL 的魔法阵扫描动画 */
/* 该动画包含：旋转的帝国边框、逆向旋转的符文环、呼吸的红丝绸底座、跳动的全视之眼以及上下扫描的金光 */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5::before {
    content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="120" height="120"><circle cx="50" cy="50" r="48" fill="none" stroke="%236a040f" stroke-width="2" stroke-dasharray="15 5"><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="360 50 50" dur="6s" repeatCount="indefinite"/></circle><circle cx="50" cy="50" r="40" fill="none" stroke="%23d4af37" stroke-width="4" stroke-dasharray="1 6" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" from="360 50 50" to="0 50 50" dur="4s" repeatCount="indefinite"/></circle><circle cx="50" cy="50" r="32" fill="%239d0208" opacity="0.2"><animate attributeName="opacity" values="0.1;0.3;0.1" dur="2s" repeatCount="indefinite"/></circle><path d="M 25,50 Q 50,25 75,50 Q 50,75 25,50 Z" fill="none" stroke="%23d4af37" stroke-width="2"/><circle cx="50" cy="50" r="8" fill="%23d4af37"><animate attributeName="r" values="6;9;6" dur="1.5s" repeatCount="indefinite"/></circle><line x1="10" y1="50" x2="90" y2="50" stroke="%23ffb703" stroke-width="1.5" opacity="0.8"><animate attributeName="y1" values="10;90;10" dur="2s" repeatCount="indefinite"/><animate attributeName="y2" values="10;90;10" dur="2s" repeatCount="indefinite"/></line></svg>') !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: block !important;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5)) !important; /* 魔法阵外发光 */
}

/* 底部添加“帝国审查中”的动态文本提示 */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5::after {
    content: "帝国审查中..." !important;
    position: absolute !important;
    bottom: -5px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-family: "Palatino Linotype", serif !important;
    font-weight: bold !important;
    font-size: 14px !important;
    color: #9d0208 !important;
    letter-spacing: 2px !important;
    animation: text-pulse 1.5s infinite alternate !important;
}

@keyframes text-pulse {
    from { opacity: 0.5; text-shadow: none; }
    to { opacity: 1; text-shadow: 0 0 5px rgba(157, 2, 8, 0.5); }
}

/* 诺瓦斯神圣帝国：边境管理局 UI 核心样式 */
ai {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; /* 中世纪复古衬线体 */
    color: #3e2723;
    font-size: 14px;
    line-height: 1.6;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" opacity="0.03"><path d="M0,0 Q100,50 200,0 T400,0 L400,200 L0,200 Z" fill="%233e2723"/></svg>'), linear-gradient(135deg, #fdf6e3 0%, #f4e8d1 50%, #e8d5b5 100%);
    padding: 10px;
    border-radius: 8px;
    box-shadow: inset 0 0 30px rgba(139, 69, 19, 0.15), 0 4px 10px rgba(0,0,0,0.3);
    border: 2px solid #b89947;
    position: relative;
}

/* 隐藏系统自检 */
ai details.sys { display: none; }

/* 模块面板基础样式 */
ai details.mod {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid #d4af37;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

ai details.mod[open] {
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.15);
    background: rgba(255, 255, 255, 0.6);
}

/* 标题栏：帝国红丝绸质感 */
ai summary {
    background: linear-gradient(90deg, #6a040f, #9d0208, #6a040f);
    color: #ffd700;
    padding: 10px 14px;
    font-weight: bold;
    font-size: 15px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #d4af37;
    position: relative;
    overflow: hidden;
}

/* 标题栏光泽扫过动画 */
ai summary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    animation: silk-shine 4s infinite;
}
@keyframes silk-shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

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

/* 标题前缀魔法宝石 */
ai summary::before {
    content: '✦';
    color: #ffb703;
    margin-right: 8px;
    font-size: 18px;
    text-shadow: 0 0 8px #ffb703, 0 0 15px #fb8500;
    animation: gem-pulse 2s infinite alternate;
}
@keyframes gem-pulse {
    from { opacity: 0.7; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.1); }
}

/* 内部容器 */
ai v {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
}

/* 网格布局 */
ai g {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: rgba(212, 175, 55, 0.1);
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #d4af37;
}

/* 数据行 */
ai d {
    display: block;
    border-bottom: 1px dashed rgba(139, 69, 19, 0.3);
    padding-bottom: 4px;
}
ai d:last-child { border-bottom: none; padding-bottom: 0; }

ai b { color: #5c3a21; font-weight: 800; margin-right: 4px; }

/* 模块小标题 */
ai h {
    display: block;
    margin-top: 6px;
    padding: 4px 8px;
    background: linear-gradient(90deg, #3e2723, transparent);
    color: #f4e8d1;
    font-weight: bold;
    border-left: 4px solid #d4af37;
    border-radius: 2px;
    text-shadow: 1px 1px 1px black;
}

/* --- 特殊状态颜色高亮 --- */
ai .gold { color: #d4af37; font-weight: bold; text-shadow: 0 0 3px rgba(212,175,55,0.6); }
ai .merit { color: #2a9d8f; font-weight: bold; text-shadow: 0 0 3px rgba(42,157,143,0.5); }
ai .stress { color: #7209b7; font-weight: bold; }

/* 警戒值危险呼吸灯 */
ai .warn { 
    color: #d62828; 
    font-weight: bold; 
    animation: danger-pulse 1.5s infinite; 
}
@keyframes danger-pulse {
    0% { text-shadow: 0 0 0 transparent; }
    50% { text-shadow: 0 0 8px rgba(214, 40, 40, 0.8); }
    100% { text-shadow: 0 0 0 transparent; }
}

/* 文本类样式 */
ai .i { font-style: italic; color: #5c3a21; }

/* 成人/生理监测专属样式 (深粉色调) */
ai .y { color: #9d0208; }
ai h.y {
    background: linear-gradient(90deg, #4a0010, transparent);
    border-left-color: #ff4d6d;
    color: #ffb3c1;
}
ai d.y { border-bottom-color: rgba(255, 77, 109, 0.2); }

/* 羁绊高亮 */
ai .hl { background: rgba(212, 175, 55, 0.15); padding: 4px; border-radius: 3px; }

/* 记忆区卷宗 */
ai mr { display: block; font-size: 12px; color: #7f5539; background: rgba(0,0,0,0.05); padding: 6px; border-radius: 4px; border: 1px solid rgba(139,69,19,0.2); margin-bottom: 6px; }
ai details.sm summary { background: transparent; color: #3e2723; border: 1px solid #b89947; text-shadow: none; font-size: 13px; padding: 6px 10px; }
ai details.sm summary::before { content: '📁'; text-shadow: none; animation: none; }
ai details.sm v { font-size: 13px; color: #5c3a21; }

/* 行动选项增强交互 */
ai details.opt d {
    background: rgba(255,255,255,0.5);
    margin-bottom: 6px;
    padding: 8px;
    border: 1px solid #d4af37;
    border-radius: 4px;
    cursor: default;
    transition: all 0.2s ease;
    border-left: 4px solid #b89947;
}
ai details.opt d:hover {
    background: #fdf6e3;
    transform: translateX(5px);
    border-left: 4px solid #d62828;
    box-shadow: 0 2px 8px rgba(139,69,19,0.2);
}

/* 正文样式 */
ai article {
    font-size: 15px;
    color: #2b1a10;
    padding: 10px 5px;
    text-align: justify;
    text-indent: 2em;
}
ai article p { margin-bottom: 10px; }

/* 移动端微调 */
@media (max-width: 600px) {
    ai g { grid-template-columns: 1fr; }
    ai { font-size: 13px; padding: 8px; }
    ai summary { font-size: 14px; padding: 8px 10px; }
    ai article { font-size: 14px; }
}