/* 核心容器：韩漫背景与基础定义 */
ai {
    display: block;
    font-family: 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: #2d2d2d;
    background-color: #f0f2f5;
    background-image: radial-gradient(#d1d1d1 1px, transparent 0);
    background-size: 12px 12px;
    padding: 10px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 话数标题栏：韩漫扉页风格 */
ai hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #333;
    color: #fff;
    padding: 8px 15px;
    transform: skewX(-10deg);
    margin: 10px 0 20px 10px;
    box-shadow: 5px 5px 0 #ffb7c5;
    border: 2px solid #000;
}

ai hd i { font-style: normal; font-weight: 900; color: #ffb7c5; font-size: 1.2em; }
ai hd span { font-size: 0.9em; letter-spacing: 1px; }

/* 剧情正文区 */
ai article {
    background: #fff;
    padding: 15px;
    margin: 15px 0;
    border: 3px solid #333;
    border-radius: 2px;
    position: relative;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.1);
}

/* 统一面板样式：漫画分镜框 */
ai details {
    background: #fff;
    border: 3px solid #333;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

ai details[open] {
    transform: rotate(0.5deg) scale(1.01);
    box-shadow: 10px 10px 0 rgba(0,0,0,0.05);
    z-index: 10;
}

ai summary {
    list-style: none;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    background: #eee;
    border-bottom: 3px solid #333;
    display: flex;
    align-items: center;
}

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

/* 装饰：胶带效果 */
ai details::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    width: 80px;
    height: 25px;
    background: rgba(255, 255, 150, 0.6);
    transform: translateX(-50%) rotate(-2deg);
    z-index: 11;
    border-left: 1px dashed rgba(0,0,0,0.1);
    border-right: 1px dashed rgba(0,0,0,0.1);
}

/* 不同模块的配色方案 */
ai details[t="env"] { border-color: #aec6cf; }
ai details[t="env"] summary { background: #aec6cf; }
ai details[t="me"] { border-color: #ffb7c5; }
ai details[t="me"] summary { background: #ffb7c5; }
ai details[t="npc"] { border-color: #e6e6fa; }
ai details[t="npc"] summary { background: #e6e6fa; }
ai details[t="club"] { border-color: #fdfd96; }
ai details[t="club"] summary { background: #fdfd96; }

/* 信息条目通用样式 */
ai d {
    display: flex;
    padding: 5px 12px;
    border-bottom: 1px dashed #ccc;
    font-size: 14px;
}

ai f {
    font-weight: bold;
    color: #555;
    min-width: 65px;
    position: relative;
}

ai f::after { content: " |"; color: #ddd; margin-left: 5px; }
ai v { color: #333; flex: 1; }

/* NPC：角色卡强化 */
ai c { display: block; padding: 10px; }
ai h2[t="name"] {
    font-size: 1.5em;
    margin: 5px 0;
    color: #333;
    text-shadow: 2px 2px 0 #e6e6fa;
    -webkit-text-stroke: 1px #333;
}

/* 核心：身体细节档案（秘密分区） */
ai section[t="secret"] {
    margin: 15px 5px;
    padding: 10px;
    background: #fff0f5;
    border: 2px dashed #ff69b4;
    border-radius: 10px;
    position: relative;
}

ai section[t="secret"] h3 {
    font-size: 14px;
    margin: -20px 0 10px 0;
    background: #ff69b4;
    color: #fff;
    display: inline-block;
    padding: 2px 10px;
    transform: rotate(-2deg);
}

ai q[t="thought"] {
    display: block;
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 15px;
    font-style: italic;
    color: #666;
    border-left: 5px solid #e6e6fa;
}

/* 社交动态：KakaoTalk & Everytime */
ai div[t="kakao"] {
    background: #fee500;
    margin: 10px;
    padding: 10px;
    border-radius: 10px;
    position: relative;
}
ai div[t="kakao"] b { display: block; font-size: 12px; color: #3c1e1e; }
ai div[t="kakao"] q { font-size: 14px; color: #3c1e1e; border: none; padding: 0; }

ai div[t="et"] {
    border: 1px solid #c62917;
    margin: 10px;
    padding: 8px;
    border-radius: 5px;
}
ai div[t="et"] b { color: #c62917; font-size: 12px; display: block; }
ai div[t="et"] span { font-size: 13px; color: #333; }

/* 记忆表格 */
ai table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 10px 0;
}
ai th { background: #333; color: #fff; padding: 5px; }
ai td { border: 1px solid #ddd; padding: 5px; text-align: center; }

/* 下一步行动：分镜选项 */
ai details[t="act"] {
    border: 3px solid #333;
    background: #333;
}
ai details[t="act"] summary {
    background: #333;
    color: #fff;
}
ai l {
    display: block;
    padding: 12px;
    margin: 8px;
    background: #fff;
    border: 2px solid #000;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    text-align: center;
}
ai l:hover {
    background: #ffb7c5;
    transform: translateX(5px);
}

/* 动效：展开时的弹跳感 */
@keyframes comicIn {
    0% { transform: scale(0.9) rotate(-1deg); opacity: 0; }
    100% { transform: scale(1) rotate(0.5deg); opacity: 1; }
}
ai details[open] > *:not(summary) {
    animation: comicIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* --- 基础：移除顶部颜色装饰条 --- */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* --- 核心：聊天框分镜化改造 --- */
.bg-gray-100\/90.relative.inline-block {
    background-color: #ffffff !important;
    /* 漫画网点背景纹理 */
    background-image: radial-gradient(#e5e5e5 1.5px, transparent 0) !important;
    background-size: 16px 16px !important;
    /* 手绘感不规则边框 */
    border: 3px solid #2d2d2d !important;
    border-radius: 4px 12px 6px 18px / 18px 6px 12px 4px !important;
    /* 漫画硬阴影 */
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.1) !important;
    padding: 12px !important;
    overflow: visible !important;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* 悬停微动效：轻微弹跳 */
.bg-gray-100\/90.relative.inline-block:hover {
    transform: translateY(-2px) scale(1.01) !important;
}

/* --- 装饰：漫画胶带贴纸 --- */
.bg-gray-100\/90.relative.inline-block::before {
    content: "" !important;
    position: absolute !important;
    top: -12px !important;
    left: 15% !important;
    width: 70px !important;
    height: 28px !important;
    /* 半透明黄色便利贴胶带 */
    background: rgba(253, 253, 150, 0.7) !important;
    transform: rotate(-4deg) !important;
    z-index: 10 !important;
    border-left: 1px dashed rgba(0,0,0,0.1) !important;
    border-right: 1px dashed rgba(0,0,0,0.1) !important;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05) !important;
    pointer-events: none !important;
}

/* --- 文本：极致可读性 --- */
.markdown-body {
    color: #2d2d2d !important;
    font-family: 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif !important;
    line-height: 1.6 !important;
    z-index: 1 !important;
    position: relative !important;
}

/* 强调文本：韩漫加粗效果 */
.markdown-body strong {
    color: #000 !important;
    background: linear-gradient(transparent 60%, #ffb7c5 60%) !important; /* 粉色划线强调 */
}

/* --- 底部元素：清爽适配 --- */
/* 操作按钮、模型名称、Token消耗 */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary,
.MuiTypography-root.MuiTypography-body2.css-6c0gf2,
.text-orange-500 {
    color: #666666 !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-size: 11px !important;
}

/* --- 加载动画：SMIL SVG 漫画星闪 --- */
/* 隐藏默认加载圆点 */
.style_dot-flashing__8L91Q.style_text__zGhNq {
    display: none !important;
}

/* 在父容器创建自定义动画 */
.flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffb7c5' d='M12,2L14.5,9H22L16,13.5L18.5,21L12,16.5L5.5,21L8,13.5L2,9H9.5L12,2Z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' values='1;0.3;1' dur='1s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    width: 24px !important;
    height: 24px !important;
}

/* --- 移动端适配 --- */
@media (max-width: 480px) {
    .bg-gray-100\/90.relative.inline-block {
        margin: 5px !important;
        box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.1) !important;
    }
    .bg-gray-100\/90.relative.inline-block::before {
        width: 50px !important;
        left: 10% !important;
    }
}
/* ============================================================
   1. 顶部栏美化：韩漫扉页风格
   ============================================================ */
.sticky.w-full.top-0.flex.items-center {
    background: #333333 !important;
    border-bottom: 4px solid #ffb7c5 !important;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1) !important;
    height: 60px !important;
}

/* 模型选择器：徽章化 */
#ai-model-selector .group.flex.items-center {
    background: #ffb7c5 !important;
    border: 2px solid #000 !important;
    border-radius: 0px !important;
    transform: skewX(-10deg) !important;
    padding: 2px 10px !important;
}

#ai-model-selector .truncate.text-\[13px\] {
    color: #000 !important;
    font-weight: 900 !important;
    transform: skewX(10deg) !important; /* 抵消外层倾斜确保文字端正 */
}

/* 顶部图标颜色适配 */
.sticky.w-full.top-0 svg, 
#header-setting-button svg {
    color: #ffb7c5 !important;
    filter: drop-shadow(2px 2px 0px #000) !important;
}

/* ============================================================
   2. 按钮栏与开场白：分镜动作条
   ============================================================ */
/* 开场白选择器 */
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"] {
    border: 3px solid #333 !important;
    border-radius: 0px !important;
    background: #fdfd96 !important; /* 经典黄色标签 */
    box-shadow: 4px 4px 0px #000 !important;
}

/* 按钮栏通用按钮 */
#ai-mod-button2 button.MuiButton-root {
    background: #ffffff !important;
    border: 2px solid #333 !important;
    border-radius: 4px !important;
    color: #333 !important;
    font-weight: bold !important;
    box-shadow: 3px 3px 0px #333 !important;
    transition: all 0.1s !important;
    margin: 0 4px !important;
}

#ai-mod-button2 button.MuiButton-root:hover {
    background: #ffb7c5 !important;
    transform: translate(-1px, -1px) !important;
    box-shadow: 5px 5px 0px #333 !important;
}

#ai-mod-button2 button.MuiButton-root:active {
    transform: translate(2px, 2px) !important;
    box-shadow: 0px 0px 0px #333 !important;
}

/* ============================================================
   3. 底部输入栏：手绘原稿纸风格
   ============================================================ */
/* 输入框外层容器 */
#ai-chat-bottom-input {
    background: #ffffff !important;
    border: 3px solid #333 !important;
    border-radius: 8px !important;
    /* 淡淡的方格纸底纹 */
    background-image: 
        linear-gradient(#e5e5e5 1px, transparent 1px),
        linear-gradient(90deg, #e5e5e5 1px, transparent 1px) !important;
    background-size: 20px 20px !important;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.05) !important;
    padding: 10px !important;
}

/* 主输入框 */
#ai-chat-input {
    background: transparent !important;
    color: #2d2d2d !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    selection-background-color: #ffb7c5 !important;
}

#ai-chat-input::placeholder {
    color: #aaa !important;
    font-style: italic !important;
}

/* ============================================================
   4. 评论区：漫画分镜评论墙
   ============================================================ */
/* 评论区主背景 */
div[class*="w-full"][class*="bg-white"][class*="bottom-0"] {
    background-color: #f9f9f9 !important;
    background-image: radial-gradient(#d1d1d1 1px, transparent 0) !important;
    background-size: 15px 15px !important;
}

/* 评论项：独立分镜框 */
div.group.ml-0 {
    background: #ffffff !important;
    border: 2px solid #333 !important;
    margin-bottom: 15px !important;
    padding: 12px !important;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.05) !important;
    position: relative !important;
}

/* 用户头像：圆形黑边 */
div.group img.rounded-full {
    border: 2px solid #333 !important;
    padding: 2px !important;
    background: #fff !important;
}

/* 用户名与标签 */
div.text-sm.text-grey-600 span.font-bold {
    color: #ff69b4 !important; /* 角色高亮色 */
}

span.text-\[10px\] {
    background: #333 !important;
    color: #fff !important;
    padding: 0 4px !important;
    border-radius: 2px !important;
}

/* 评分星星 */
span.MuiRating-iconFilled svg {
    color: #ffb7c5 !important;
    filter: drop-shadow(1px 1px 0px #000) !important;
}

/* 发送评论按钮：动作感 */
div.cursor-pointer.group.flex.items-center.justify-center {
    background: #333 !important;
    border-radius: 4px !important;
    transform: rotate(2deg) !important;
    transition: 0.2s !important;
}

div.cursor-pointer.group.flex.items-center.justify-center:hover {
    transform: rotate(0deg) scale(1.1) !important;
    background: #ffb7c5 !important;
}

/* ============================================================
   5. 分页栏：极简黑白配
   ============================================================ */
.MuiPaginationItem-root {
    border: 2px solid #333 !important;
    border-radius: 0px !important;
    font-weight: bold !important;
}

.MuiPaginationItem-root.Mui-selected {
    background: #333 !important;
    color: #ffb7c5 !important;
}