/* ==================================================================
   🍀 校园活力青春风主题 CSS (隐藏红框数据链、状态栏修复与极致紧凑版)
   ================================================================== */

/* 🚫 强制隐藏红框内的 GM 判定数据链 (独立规则，防止浏览器解析异常丢弃) */
.gm-chain,
div.gm-chain,
[class*="gm-chain"],
gm-chain {
    display: none !important;
}

/* 🚫 强制隐藏通用思维链与思考推理区域 */
.thought, 
.reasoning, 
.chat-thought-container,
.thought-container,
div[class*="thought"],
div[class*="reasoning"],
details[class*="thought"],
details[class*="reasoning"],
[class*="thought-"],
[class*="-thought"],
[class*="reasoning-"],
[class*="-reasoning"] {
    display: none !important;
}

/* 🎨 统一全局聊天气泡基础设定 */
.group.is-user > div:first-child, 
.group.is-assistant > div:first-child {
    border: none !important;
    transition: all 0.3s ease !important;
}

/* 🔵 用户气泡：活力海盐蓝 */
.group.is-user > div:first-child {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
    border: 2px solid #7dd3fc !important;
    border-radius: 20px 20px 4px 20px !important;
    box-shadow: 0 4px 15px rgba(125, 211, 252, 0.2) !important;
}

/* 🟢 助手气泡：操场微风草绿 */
.group.is-assistant > div:first-child {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%) !important;
    border: 2px solid #bbf7d0 !important;
    border-radius: 20px 20px 20px 4px !important;
    box-shadow: 0 4px 15px rgba(187, 247, 208, 0.15) !important;
}

/* ✍️ 极致可读性正文文字覆盖 */
.rili-markdown-renderer, 
.rili-markdown-renderer * {
    color: #0f172a !important; /* 几乎纯黑的深海蓝，确保文字绝对清晰 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.8 !important;
    font-size: 15.5px !important;
}

/* 🏫 对话角色高亮染色 */
.dia-pc { color: #0284c7 !important; font-weight: bold !important; }
.dia-zhao { color: #db2777 !important; font-weight: bold !important; }
.dia-chen { color: #7c3aed !important; font-weight: bold !important; }
.dia-jiesi { color: #ea580c !important; font-weight: bold !important; }
.dia-npc { color: #4b5563 !important; font-weight: 500 !important; }

/* ⏱️ 顶部状态栏（极致紧凑与高亮对比度修复） */
status-top {
    background: #0f172a !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 6px 12px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 2px solid #0ea5e9 !important;
    font-size: 12px !important;
    margin-top: 8px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}

/* 强制覆盖Markdown容器的文字颜色，确保深色背景下的状态栏文字绝对可见 */
.rili-markdown-renderer status-top,
.rili-markdown-renderer status-top *,
status-top,
status-top * {
    color: #38bdf8 !important; /* 亮天蓝色 */
}
status-top p {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 !important;
    font-weight: 700 !important;
}

/* 📊 属性进度条区域（超紧凑自适应重构） */
pulse-bar {
    background: #ffffff !important;
    border-left: 2px solid #e2e8f0 !important;
    border-right: 2px solid #e2e8f0 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-radius: 0 0 12px 12px !important;
    padding: 8px 12px !important; /* 压缩内边距 */
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important; /* 行间距最小化 */
    margin-bottom: 15px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02) !important;
}

.pulse {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 3px 0 !important; /* 单行上下内边距压缩 */
    border-bottom: 1px dashed rgba(226, 232, 240, 0.6) !important;
}

.pulse:last-child {
    border-bottom: none !important;
}

/* 左侧状态名称与图标垂直紧凑对齐 */
.pulse > *:first-child {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 48px !important;
    flex-shrink: 0 !important;
    line-height: 1.1 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #334155 !important;
}

/* 核心优化：高对比度、弹性自适应进度条 */
.pulse .bar {
    flex: 1 !important; /* 多个进度条时自动平分并紧凑排开 */
    width: auto !important;
    background: #f1f5f9 !important; 
    border-radius: 12px !important;
    position: relative !important;
    height: 15px !important; /* 高度压缩 */
    line-height: 15px !important;
    overflow: hidden !important;
    font-size: 10px !important;
    text-align: center !important;
    border: 1px solid #cbd5e1 !important;
    
    /* 极致文字清晰度保障 */
    color: #0f172a !important; 
    font-weight: 900 !important;
    text-shadow: 
        -1.5px -1.5px 0 #ffffff,  
         1.5px -1.5px 0 #ffffff,
        -1.5px  1.5px 0 #ffffff,
         1.5px  1.5px 0 #ffffff,
         0px 0px 3px #ffffff !important;
    z-index: 2 !important;
}

.pulse .bar::before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    height: 100% !important;
    width: var(--p) !important;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: -1 !important;
}

/* 进度条彩色背景填充 */
.pulse.normal .bar::before { background: linear-gradient(90deg, #60a5fa, #3b82f6) !important; }
.pulse.blood .bar::before { background: linear-gradient(90deg, #f87171, #ef4444) !important; }
.pulse.elevated .bar::before { background: linear-gradient(90deg, #f472b6, #ec4899) !important; }

/* 🖼️ CG 特写区域 */
.cg-frame {
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f6 100%) !important;
    border: 2px dashed #ff758f !important;
    border-left: 6px solid #ff758f !important;
    border-radius: 12px !important;
    padding: 12px !important;
    margin: 12px 0 !important;
    box-shadow: 0 6px 20px rgba(255, 117, 143, 0.15) !important;
    position: relative !important;
}

.cg-frame::before {
    content: "🎬 CLASSRoom MEMORY / CG 特写" !important;
    display: block !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    color: #ff758f !important;
    letter-spacing: 1.5px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 117, 143, 0.2) !important;
    padding-bottom: 4px !important;
}

/* 💭 少女内心独白区 */
inner-voice {
    background: rgba(253, 244, 245, 0.9) !important;
    border-left: 4px solid #f43f5e !important;
    border-radius: 4px 12px 12px 4px !important;
    padding: 8px 12px !important;
    margin: 8px 0 !important;
    display: block !important;
    font-style: italic !important;
}
inner-voice * {
    color: #9f1239 !important;
}

/* 🧔 苦主/旁观视角 */
husband-pov {
    background: rgba(240, 253, 250, 0.9) !important;
    border-left: 4px solid #0d9488 !important;
    border-radius: 4px 12px 12px 4px !important;
    padding: 8px 12px !important;
    margin: 8px 0 !important;
    display: block !important;
}
husband-pov * {
    color: #115e59 !important;
}

/* 🗂️ 底部卡片式课本折叠面板 */
status-bottom {
    display: block !important;
    margin-top: 10px !important;
    border-top: 1px dashed #cbd5e1 !important;
    padding-top: 8px !important;
}

details.mod {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    margin-bottom: 6px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02) !important;
}

details.mod summary {
    background: #f8fafc !important;
    padding: 8px 10px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    color: #334155 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

details.mod[open] summary {
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

/* 🟢🔘🔴 选项按钮青春美化 */
.act {
    padding: 8px 12px !important;
    margin: 4px 0 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    cursor: pointer !important;
}
.act:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}
.act-safe { background: #f0fdf4 !important; border: 1px solid #bbf7d0 !important; color: #166534 !important; }
.act-mid { background: #fffbeb !important; border: 1px solid #fef3c7 !important; color: #9a3412 !important; }
.act-bold { background: #fff5f5 !important; border: 1px solid #fed7aa !important; color: #9a3412 !important; }


/* ==================================
   📱 微信内嵌 UI (细节融合版)
   ================================== */
div.wx-box {
    display: flex !important;
    flex-direction: column !important;
    background: #f3f3f3 !important;
    padding: 10px !important;
    border-radius: 12px !important;
    margin: 10px 0 !important;
    border: 1px solid #e5e5e5 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

div.wx-sys {
    align-self: center !important;
    font-size: 11px !important;
    color: #b2b2b2 !important;
    background: rgba(0,0,0,0.05) !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    margin-bottom: 8px !important;
    width: fit-content !important;
}

div.wx-right, div.wx-left {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    align-items: flex-start !important;
}
div.wx-right { justify-content: flex-end !important; }
div.wx-left { justify-content: flex-start !important; }

[class^="wx-avatar-"] {
    width: 36px !important;
    height: 36px !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
    background-size: cover !important;
    background-position: center !important;
    background-color: #e1e1e1 !important;
    font-size: 0 !important;
    color: transparent !important;
    overflow: hidden !important;
}

div.wx-avatar-me {
    width: 36px !important;
    height: 36px !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
    background-size: cover !important;
    background-position: center !important;
    margin-left: 8px !important;
    background-image: url('https://cdn.jsdelivr.net/gh/Gungnir0910/wunianzhitouxiang@main/wanjiatouxiang2.webp') !important;
}

div.wx-left [class^="wx-avatar-"] {
    margin-right: 8px !important;
}

div.wx-avatar-zhao { background-image: url('https://cdn.jsdelivr.net/gh/Gungnir0910/wunianzhitouxiang@main/zhaojingtouxiang.webp') !important; }
div.wx-avatar-chen { background-image: url('https://cdn.jsdelivr.net/gh/Gungnir0910/wunianzhitouxiang@main/chenqiuyutouxiang.webp') !important; }
div.wx-avatar-jie { background-image: url('https://cdn.jsdelivr.net/gh/Gungnir0910/wunianzhitouxiang@main/jiesitouxaing.webp') !important; }
div.wx-avatar-lv { background-image: url('https://cdn.jsdelivr.net/gh/Gungnir0910/wunianzhitouxiang@main/lvjietouxiang.webp') !important; }

div.wx-msg {
    max-width: 65% !important;
    padding: 8px 10px !important;
    border-radius: 4px !important;
    font-size: 13.5px !important;
    line-height: 1.4 !important;
    word-break: break-all !important;
}

div.wx-me {
    background: #95ec69 !important;
    color: #191919 !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 4px !important;
}

div.wx-her {
    background: #ffffff !important;
    color: #191919 !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 4px !important;
}

div.wx-pay {
    background: #f79c39 !important;
    color: #ffffff !important;
    font-weight: bold !important;
    font-size: 13px !important;
    border: 1px solid #e08b2b !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    min-width: 130px !important;
}
div.wx-pay::before {
    content: "¥" !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(255,255,255,0.9) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 8px !important;
    font-weight: normal !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
}

anchor-teacher, anchor-focus, anchor-stage, anchor-cg {
    display: none !important;
}