/* ========================================================= */
/* --- 1. 字体与基础设置 (蜜桃熟夏 · 暗欲主题) --- */
/* ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;600;700&family=Noto+Serif+SC:wght@600;700&family=Playfair+Display:wght@400;600;700&display=swap');

/* 主题色变量（源自简介配色系统） */
:root {
    --peach-gold: #d4a853;
    --peach-gold-light: #f0d080;
    --peach-gold-glow: rgba(212, 168, 83, 0.35);
    --peach-dark: #0a0808;
    --peach-dark-red: #1a0808;
    --peach-cream: #f5efe6;
    --peach-rose: #d4a0a0;
    --peach-rose-glow: rgba(212, 160, 160, 0.30);
    --peach-charcoal: #1a0e0e;
    --peach-warm: #fdf8f0;
    --peach-crimson: #b84a4a;
    --peach-gold-deep: #b8923a;
    --peach-shadow: rgba(0, 0, 0, 0.30);
}

.cinnamoroll-bubble {
    position: relative;
    margin: 28px 2px 32px 2px;
    border-radius: 8px;
    font-family: 'Noto Sans SC', 'Inter', sans-serif;
    transition: all 0.25s ease-in-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    line-height: 1.7;
}

.cinnamoroll-content {
    padding: 16px 4px !important;
    position: relative;
    z-index: 2;
}

.inazuma-message-text {
    font-size: 15px;
    line-height: 1.8;
    text-align: justify;
    overflow-wrap: break-word;
    word-wrap: break-word;
    font-weight: 400;
}

/* ========================================================= */
/* --- 2. AI 气泡：蜜桃卷 · 暗欲秘语 (米勒夫人/说书人) --- */
/* ========================================================= */
.cinnamoroll-bubble.ai-bubble {
    background: linear-gradient(145deg, #fdf8f0, #f5efe6);
    border-left: 5px solid var(--peach-rose);
    color: var(--peach-dark);
    border-radius: 8px 8px 8px 4px;
}

.cinnamoroll-bubble.ai-bubble::before {
    content: "🍑 蜜桃卷 · 暗欲秘语...";
    position: absolute;
    top: -26px;
    left: 0px;
    font-size: 13px;
    font-weight: 700;
    color: var(--peach-dark-red);
    background: var(--peach-warm);
    padding: 2px 12px 2px 10px;
    border-radius: 6px 6px 0 0;
    border: 1px solid rgba(212, 160, 160, 0.20);
    border-bottom: none;
    letter-spacing: 0.5px;
    font-family: 'Noto Serif SC', 'Playfair Display', serif;
}

.cinnamoroll-bubble.ai-bubble::after {
    content: '🍑';
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 22px;
    color: var(--peach-rose);
    opacity: 0.25;
    z-index: 1;
    filter: drop-shadow(0 0 6px rgba(212, 160, 160, 0.15));
}

/* AI 气泡内文字颜色（浅色背景 → 深色文字，确保清晰） */
.cinnamoroll-bubble.ai-bubble .inazuma-message-text {
    color: var(--peach-dark);
}

/* ========================================================= */
/* --- 3. User 气泡：盛夏行 · 闯入者 (玩家) --- */
/* ========================================================= */
.cinnamoroll-bubble.user-bubble {
    background: linear-gradient(145deg, #1a0e0e, #0d0808);
    border-right: 5px solid var(--peach-gold);
    color: var(--peach-cream);
    border-radius: 8px 8px 4px 8px;
}

.cinnamoroll-bubble.user-bubble::before {
    content: "🔥 盛夏行 · 闯入者...";
    position: absolute;
    top: -26px;
    right: 0px;
    font-size: 13px;
    font-weight: 700;
    color: var(--peach-gold-light);
    background: #1a0e0e;
    padding: 2px 10px 2px 12px;
    border-radius: 6px 6px 0 0;
    border: 1px solid rgba(212, 168, 83, 0.20);
    border-bottom: none;
    letter-spacing: 0.5px;
    font-family: 'Noto Serif SC', 'Playfair Display', serif;
    text-shadow: 0 0 12px rgba(212, 168, 83, 0.12);
}

.cinnamoroll-bubble.user-bubble::after {
    content: '闯';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 18px;
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    color: var(--peach-gold);
    border: 2px solid var(--peach-gold);
    padding: 0px 5px;
    opacity: 0.50;
    z-index: 1;
    border-radius: 4px;
    background: rgba(212, 168, 83, 0.06);
    line-height: 1.4;
}

/* 用户气泡内文字颜色（深色背景 → 浅色文字，确保清晰） */
.cinnamoroll-bubble.user-bubble .inazuma-message-text {
    color: var(--peach-cream);
}

/* ========================================================= */
/* --- 4. 文本特殊颜色转换 (Markdown 增强) --- */
/* ========================================================= */

/* 加粗 (Strong) -> 蜜桃深红 · 欲望凝聚 */
.inazuma-message-text strong {
    color: var(--peach-crimson) !important;
    font-weight: 700;
}

/* 斜体 (Em) -> 蜜桃金 · 成熟韵味 */
.inazuma-message-text em {
    color: var(--peach-gold-deep) !important;
    font-style: italic;
}

/* 加粗斜体 -> 璀璨金 · 极致诱惑 */
.inazuma-message-text strong em,
.inazuma-message-text em strong {
    color: var(--peach-gold-light) !important;
    text-shadow: 0 0 8px rgba(212, 168, 83, 0.55), 0 0 24px rgba(212, 168, 83, 0.15);
    font-weight: 700;
}

/* 标题 (Header) -> 浓墨书法 · 暗欲标题 */
.inazuma-message-text h1,
.inazuma-message-text h2,
.inazuma-message-text h3 {
    color: var(--peach-dark) !important;
    border-bottom: 2px solid var(--peach-gold);
    padding-bottom: 4px;
    margin: 14px 0 8px 0;
    font-family: 'Noto Serif SC', 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* 标题在用户气泡（深色背景）中的适配 */
.user-bubble .inazuma-message-text h1,
.user-bubble .inazuma-message-text h2,
.user-bubble .inazuma-message-text h3 {
    color: var(--peach-cream) !important;
    border-bottom-color: var(--peach-gold-light);
}

/* 删除线 -> 往事如烟 · 身陨道消 */
.inazuma-message-text del {
    color: #888888;
    text-decoration: line-through;
    opacity: 0.70;
}

/* ========================================================= */
/* --- 5. 代码块：蜜桃秘卷 · 暗欲心法 --- */
/* ========================================================= */
pre {
    margin: 12px 0px !important;
    padding: 32px 4px 10px 4px !important;
    background: #f0e6d2 !important;
    border-radius: 6px;
    border: 1px solid var(--peach-gold);
    position: relative;
    overflow-x: hidden;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.08);
}

pre::before {
    content: "📜 蜜桃秘卷 // 暗欲心法...";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 26px;
    background: var(--peach-gold-deep);
    color: var(--peach-cream);
    font-size: 12px;
    line-height: 26px;
    padding-left: 10px;
    border-bottom: 1px solid var(--peach-gold);
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: 'Noto Sans SC', sans-serif;
    border-radius: 6px 6px 0 0;
}

pre code {
    font-family: 'Consolas', 'Courier New', monospace !important;
    font-size: 13px !important;
    color: var(--peach-dark) !important;
    font-weight: 600 !important;
    line-height: 1.7 !important;
    white-space: pre-wrap;
    word-break: break-all;
}

pre code strong {
    color: var(--peach-crimson) !important;
}
pre code em {
    color: var(--peach-gold-deep) !important;
    font-style: italic;
}

/* ========================================================= */
/* --- 6. 其它细节修饰 --- */
/* ========================================================= */

/* 引用块：诗号/箴言/旁白 */
blockquote {
    margin: 10px 4px;
    padding: 10px 14px;
    background: rgba(212, 168, 83, 0.06);
    border-left: 4px solid var(--peach-rose);
    color: var(--peach-dark) !important;
    font-weight: 600 !important;
    font-size: 14px;
    font-style: italic;
    border-radius: 2px 6px 6px 2px;
    line-height: 1.7;
}

blockquote strong {
    color: var(--peach-crimson) !important;
}

blockquote em {
    color: var(--peach-gold-deep) !important;
}

/* 用户气泡内的引用块适配（深色背景） */
.user-bubble blockquote {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: var(--peach-gold);
    color: var(--peach-cream) !important;
}
.user-bubble blockquote strong {
    color: var(--peach-gold-light) !important;
}
.user-bubble blockquote em {
    color: var(--peach-rose) !important;
}

/* 分割线：蜜色笔触 / 场景变换 */
hr {
    border: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--peach-gold), transparent);
    margin: 22px 0;
    opacity: 0.40;
    border-radius: 2px;
}

/* 列表样式增强 */
.inazuma-message-text ul,
.inazuma-message-text ol {
    padding-left: 22px;
    margin: 6px 0;
}

.inazuma-message-text li {
    line-height: 1.8;
    margin: 2px 0;
}

/* 链接 */
.inazuma-message-text a {
    color: var(--peach-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}
.inazuma-message-text a:hover {
    color: var(--peach-gold-light);
}

.user-bubble .inazuma-message-text a {
    color: var(--peach-gold-light);
}
.user-bubble .inazuma-message-text a:hover {
    color: var(--peach-cream);
}

/* ========================================================= */
/* --- 7. 移动端优化 --- */
/* ========================================================= */
@media (max-width: 600px) {
    .cinnamoroll-bubble {
        margin: 20px 1px 26px 1px;
        border-radius: 6px;
    }
    .cinnamoroll-content {
        padding: 12px 3px !important;
    }
    .cinnamoroll-bubble::before {
        top: -22px;
        font-size: 11px;
        padding: 1px 10px;
    }
    .cinnamoroll-bubble::after {
        font-size: 18px;
        bottom: 4px;
        right: 6px;
    }
    .cinnamoroll-bubble.user-bubble::after {
        font-size: 15px;
        top: 8px;
        left: 8px;
        padding: 0px 4px;
    }
    .inazuma-message-text {
        font-size: 14px;
        line-height: 1.7;
    }
    pre {
        padding: 28px 3px 8px 3px !important;
    }
    pre::before {
        font-size: 11px;
        height: 24px;
        line-height: 24px;
    }
    pre code {
        font-size: 12px !important;
    }
    blockquote {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ========================================================= */
/* --- 8. 深色/浅色背景通用文字清晰保障 --- */
/* ========================================================= */

/* 确保所有文字在各自背景上都有足够对比度 */
.cinnamoroll-bubble.ai-bubble .inazuma-message-text {
    color: #1a0e0e;
}
.cinnamoroll-bubble.user-bubble .inazuma-message-text {
    color: #f5efe6;
}

/* 特殊强调色在浅色背景上保持清晰 */
.ai-bubble .inazuma-message-text strong {
    color: #b84a4a !important;
}
.ai-bubble .inazuma-message-text em {
    color: #b8923a !important;
}
.ai-bubble .inazuma-message-text strong em,
.ai-bubble .inazuma-message-text em strong {
    color: #d4a853 !important;
    text-shadow: 0 0 8px rgba(212, 168, 83, 0.40);
}

/* 特殊强调色在深色背景上保持清晰 */
.user-bubble .inazuma-message-text strong {
    color: #d47a5a !important;
}
.user-bubble .inazuma-message-text em {
    color: #f0d080 !important;
}
.user-bubble .inazuma-message-text strong em,
.user-bubble .inazuma-message-text em strong {
    color: #ffd700 !important;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.50), 0 0 32px rgba(255, 215, 0, 0.15);
}

/* 滚动条美化（适用于包含气泡的容器） */
.message-container::-webkit-scrollbar {
    width: 4px;
}
.message-container::-webkit-scrollbar-track {
    background: transparent;
}
.message-container::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.20);
    border-radius: 10px;
}

/* ========================================================= */
/* --- 9. 额外：气泡入场微动效 --- */
/* ========================================================= */
.cinnamoroll-bubble {
    animation: bubbleFadeIn 0.35s ease forwards;
    opacity: 0;
    transform: translateY(6px);
}

@keyframes bubbleFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 连续气泡消除重复动画 */
.cinnamoroll-bubble + .cinnamoroll-bubble {
    animation: none;
    opacity: 1;
    transform: none;
}