/* --- 异度之刃2 (Xenoblade Chronicles 2) 全局主题UI (APP兼容版) --- */

.max-w-\[720px\] {
    --dialogue-bg: #0a192f;
    --dialogue-border: #00ffcc;
    --dialogue-shadow: 0 8px 25px rgba(0, 255, 204, 0.3);
    --details-border-color: #0096ff;
    --details-header-bg: #020c1b;
    --details-header-bg-hover: #112240;
    --details-header-shadow: 0 4px 10px rgba(0, 150, 255, 0.2);
    --details-header-shadow-hover: 0 6px 15px rgba(0, 255, 204, 0.3);
    --content-bg: #050f1a;
    --text-color-primary: #e6f1ff;
    --text-color-secondary: #00ffcc;
    --text-color-title: #64ffda;
    --border-radius-main: 8px;
    --border-radius-inner: 6px;
}

/* --- 全局颜色调整 --- */
.markdown-body {
    color: #e6f1ff !important;
    background: #020c1b !important;
}

/* --- 正文文字大小修正 --- */
.markdown-body p {
    font-size: 16px !important;
    line-height: 1.8 !important;
    color: #e6f1ff !important;
}

/* --- 对话框样式 --- */
.chat-container .group .relative.inline-block {
    background-color: #0a192f !important;
    border: 1px solid #00ffcc !important;
    box-shadow: 0 8px 25px rgba(0, 255, 204, 0.2) !important;
    border-radius: 8px !important;
    color: #e6f1ff !important;
}

.chat-container .group .relative.inline-block > .MuiBox-root.css-0 {
    display: none !important;
}

/* --- 对话框内所有文字颜色强制修正 --- */
.chat-container .group .relative.inline-block * {
    color: #e6f1ff !important;
}

/* --- 对话框内按钮 (复制, 编辑等) --- */
.chat-container .group .MuiButtonBase-root.MuiButton-root.MuiButton-text {
    background: #050f1a !important;
    color: #00ffcc !important;
    border: 1px solid #0096ff !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
    padding: 4px 12px !important;
    min-width: auto !important;
    line-height: 1.5 !important;
}

.chat-container .group .MuiButtonBase-root.MuiButton-root.MuiButton-text:hover {
    background: #112240 !important;
    color: #64ffda !important;
    border-color: #00ffcc !important;
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.4) !important;
}

/* --- 状态栏容器 (Details) --- */
.markdown-body details {
    border: 1px solid #0096ff !important;
    border-radius: 8px !important;
    margin: 16px 0 !important;
    background-color: #050f1a !important;
    overflow: hidden !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4) !important;
}

.markdown-body details:hover {
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.3) !important;
    border-color: #00ffcc !important;
}

/* --- 状态栏标题 (Summary) --- */
.markdown-body summary {
    display: flex !important;
    align-items: center !important;
    padding: 12px 20px !important;
    cursor: pointer !important;
    background: #0a192f !important;
    color: #64ffda !important;
    font-weight: 600 !important;
    font-size: 1.1em !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    list-style: none !important;
    position: relative !important;
}

.markdown-body summary::-webkit-details-marker {
    display: none !important;
}

.markdown-body summary:hover {
    background: #112240 !important;
}

.markdown-body summary::before {
    content: '◆' !important;
    display: inline-block !important;
    margin-right: 12px !important;
    font-size: 0.9em !important;
    color: #64ffda !important;
}

.markdown-body details[open] > summary::before {
    transform: rotate(90deg) !important;
}

/* --- 状态栏内容区 (代码块等) --- */
.markdown-body details > pre,
.markdown-body details > table {
    margin: 0 !important;
    border: none !important;
    border-top: 1px solid #0096ff !important;
    border-radius: 0 !important;
    background-color: #020c1b !important;
    overflow-x: auto !important;
}

.markdown-body details pre > div:first-child[style*="border-color"] {
    display: none !important;
}

.markdown-body details pre {
    padding: 0 !important;
    background: #020c1b !important;
}

.markdown-body details pre > div[node="[object Object]"] {
    padding: 16px 20px !important;
    background: #020c1b !important;
}

/* --- 状态栏内容字体修正 --- */
.markdown-body details pre code {
    font-size: 14px !important;
    line-height: 1.7 !important;
    color: #e6f1ff !important;
    background: transparent !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
}

/* --- 状态栏内所有文字颜色强制修正 --- */
.markdown-body details * {
    color: #e6f1ff !important;
}

/* --- 平台功能按钮 (Mod, 流式等) --- */
.flex.items-center.gap-2.pb-2 > button {
    background: #050f1a !important;
    color: #00ffcc !important;
    border: 1px solid #0096ff !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4) !important;
    font-weight: 500 !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
    padding: 6px 14px !important;
}

.flex.items-center.gap-2.pb-2 > button:hover {
    background: #112240 !important;
    color: #64ffda !important;
    border-color: #00ffcc !important;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.4) !important;
}

/* --- 输入框美化 --- */
#ai-chat-input {
    background-color: #050f1a !important;
    border: 1px solid #0096ff !important;
    border-radius: 6px !important;
    color: #e6f1ff !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3) !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
}

#ai-chat-input:focus {
    border-color: #00ffcc !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 8px rgba(0, 255, 204, 0.4) !important;
}

/* 输入框容器 */
#ai-chat-bottom-input {
    background: #020c1b !important;
    border-top: 1px solid #0096ff !important;
    padding: 8px !important;
}

/* --- 加载动画 - 旋转菱形 --- */
@keyframes ai-answer-spinner-rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 修正加载动画的父容器 */
div:has(> .style_dot-flashing__8L91Q.style_text__zGhNq) {
    justify-content: flex-start !important;
    width: auto !important;
    height: auto !important;
}

/* 修正加载动画的提示文字 */
div:has(> .style_dot-flashing__8L91Q.style_text__zGhNq)::after {
    content: '幽界引擎演算中，请稍候...' !important;
    font-size: 14px !important;
    color: #00ffcc !important;
    margin-left: 10px !important;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.5) !important;
}

/* 隐藏原版动画的伪元素 */
.style_dot-flashing__8L91Q.style_text__zGhNq::before,
.style_dot-flashing__8L91Q.style_text__zGhNq::after {
    content: none !important;
    display: none !important;
}

/* 将原版动画替换为旋转菱形 */
.style_dot-flashing__8L91Q.style_text__zGhNq {
    position: relative !important;
    background: #00ffcc !important;
    width: 16px !important;
    height: 16px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    animation: ai-answer-spinner-rotation 2s linear infinite !important;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%) !important;
    box-shadow: 0 0 8px #00ffcc !important;
}

/* --- 额外的APP兼容性修正 --- */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: #64ffda !important;
}

.markdown-body a {
    color: #00ffcc !important;
}

.markdown-body code {
    color: #e6f1ff !important;
    background: #050f1a !important;
}

.markdown-body blockquote {
    color: #e6f1ff !important;
    border-left-color: #0096ff !important;
}


/* =======================================================================
   下方为御刃者终端 HUD 专属样式 (#chat-ui-b2C3d4E5)
   ======================================================================= */

#chat-ui-b2C3d4E5 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font-size: clamp(10px, 1.2vw, 14px);
    position: relative;
    user-select: none;
    background: 
        linear-gradient(rgba(5, 15, 40, 0.5), rgba(2, 5, 20, 0.8)),
        url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAESIgRpwphJj0W3iaCkteSg2pBe0AMnJAACuiwAApbxEFbeYxAjUYt-EToE.png') center/cover no-repeat;
    border-top: 0.2em solid rgba(0, 255, 204, 0.7);
    border-bottom: 0.2em solid rgba(0, 255, 204, 0.7);
    box-shadow: 0 0 2em rgba(0, 255, 204, 0.4), inset 0 0 4em rgba(0, 150, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5em 1em;
    min-height: 8em;
    overflow: visible;
    gap: 1em; 
    flex-wrap: nowrap;
}
#chat-ui-b2C3d4E5 * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
#chat-ui-b2C3d4E5 summary {
    list-style: none;
    outline: none;
    cursor: pointer;
    display: block; 
    background: transparent !important; /* 覆盖全局summary样式 */
    padding: 0 !important; /* 覆盖全局summary样式 */
}
#chat-ui-b2C3d4E5 summary::before {
    content: none !important; /* 移除全局summary的菱形前缀 */
}
#chat-ui-b2C3d4E5 summary::-webkit-details-marker {
    display: none;
}
#chat-ui-b2C3d4E5 details {
    border: none !important; /* 覆盖全局details样式 */
    background: transparent !important; /* 覆盖全局details样式 */
    box-shadow: none !important; /* 覆盖全局details样式 */
    margin: 0 !important; /* 覆盖全局details样式 */
    overflow: visible !important; /* 允许弹出框溢出 */
}
#chat-ui-b2C3d4E5 details:hover {
    box-shadow: none !important;
    border-color: transparent !important;
}
#chat-ui-b2C3d4E5 .diamond-cluster {
    position: relative;
    display: grid;
    grid-template-columns: 2.8em 2.8em 2.8em;
    grid-template-rows: 2.8em 2.8em 2.8em;
    gap: 0.2em;
    flex-shrink: 0;
}
#chat-ui-b2C3d4E5 .pos-top    { grid-column: 2; grid-row: 1; }
#chat-ui-b2C3d4E5 .pos-left   { grid-column: 1; grid-row: 2; }
#chat-ui-b2C3d4E5 .pos-right  { grid-column: 3; grid-row: 2; }
#chat-ui-b2C3d4E5 .pos-bottom { grid-column: 2; grid-row: 3; }
#chat-ui-b2C3d4E5 .diamond-btn {
    position: relative;
}
#chat-ui-b2C3d4E5 .diamond-shape {
    width: 2.6em;
    height: 2.6em;
    margin: 0.1em auto;
    background: linear-gradient(135deg, rgba(0, 40, 80, 0.8) 0%, rgba(0, 100, 150, 0.9) 100%);
    border: 0.15em solid rgba(0, 255, 204, 0.6);
    box-shadow: 0 0 0.8em rgba(0, 255, 204, 0.4), inset 0 0 0.8em rgba(0, 150, 255, 0.5);
    transform: rotate(45deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    pointer-events: none; 
}
#chat-ui-b2C3d4E5 .btn-text {
    transform: rotate(-45deg) skewY(-15deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
    font-style: italic;
    font-weight: 900;
    font-size: 0.72em;
    color: #e0f7fa;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.9), 0 0 5px rgba(0, 255, 204, 0.8);
    letter-spacing: 0.05em;
    white-space: nowrap;
}
#chat-ui-b2C3d4E5 summary:hover .diamond-shape {
    transform: rotate(405deg) scale(1.1);
    background: linear-gradient(135deg, rgba(0, 150, 220, 0.9) 0%, rgba(0, 255, 204, 0.9) 100%);
    border-color: #fff;
    box-shadow: 0 0 1.5em rgba(0, 255, 204, 1), inset 0 0 1em rgba(255, 255, 255, 0.8);
}
#chat-ui-b2C3d4E5 summary:hover .btn-text {
    transform: rotate(-405deg) skewY(-15deg);
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.9), 0 0 8px #fff;
}
#chat-ui-b2C3d4E5 .special-ultimate .diamond-shape {
    background: linear-gradient(135deg, rgba(80, 0, 120, 0.8) 0%, rgba(150, 0, 200, 0.9) 100%);
    border-color: rgba(255, 150, 255, 0.7);
    box-shadow: 0 0 1em rgba(200, 50, 255, 0.6), inset 0 0 0.8em rgba(255, 100, 200, 0.5);
}
#chat-ui-b2C3d4E5 .special-ultimate summary:hover .diamond-shape {
    background: linear-gradient(135deg, rgba(150, 0, 200, 0.9) 0%, rgba(255, 50, 255, 0.9) 100%);
    box-shadow: 0 0 2em rgba(255, 50, 255, 1), inset 0 0 1.5em rgba(255, 255, 255, 0.8);
}
#chat-ui-b2C3d4E5 .center-cluster {
    position: relative;
    display: flex;
    gap: 1.5em; 
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    flex-wrap: nowrap;
}
#chat-ui-b2C3d4E5 .center-btn {
    position: relative;
}
#chat-ui-b2C3d4E5 .square-box {
    width: 3.2em;
    height: 3.2em;
    background: linear-gradient(180deg, rgba(10, 30, 60, 0.8) 0%, rgba(0, 60, 100, 0.9) 100%);
    border: 0.15em solid rgba(0, 150, 255, 0.7);
    border-radius: 0.4em;
    box-shadow: 0 0 0.8em rgba(0, 150, 255, 0.4), inset 0 0 0.8em rgba(0, 255, 204, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(0deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, box-shadow 0.3s;
    pointer-events: none;
}
#chat-ui-b2C3d4E5 .center-text {
    transform: rotate(0deg) skewY(-15deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
    font-style: italic;
    font-weight: 900;
    font-size: 0.85em;
    color: #a0e0ff;
    text-shadow: 1px 1px 2px #000, 0 0 5px rgba(0, 150, 255, 0.8);
    text-align: center;
    line-height: 1.1;
}
#chat-ui-b2C3d4E5 summary:hover .square-box {
    transform: rotate(360deg) scale(1.1);
    background: linear-gradient(180deg, rgba(0, 100, 180, 0.9) 0%, rgba(0, 200, 255, 0.9) 100%);
    border-color: #00ffcc;
    box-shadow: 0 0 1.5em rgba(0, 255, 204, 0.8), inset 0 0 1em rgba(255, 255, 255, 0.6);
}
#chat-ui-b2C3d4E5 summary:hover .center-text {
    transform: rotate(-360deg) skewY(-15deg);
    color: #ffffff;
    text-shadow: 1px 1px 2px #000, 0 0 8px #00ffcc;
}
#chat-ui-b2C3d4E5 details {
    position: relative;
}
#chat-ui-b2C3d4E5 details[open] {
    z-index: 9999;
}
#chat-ui-b2C3d4E5 .diamond-cluster:has(details[open]),
#chat-ui-b2C3d4E5 .center-cluster:has(details[open]) {
    z-index: 9999;
}
#chat-ui-b2C3d4E5 .info-panel {
    position: absolute;
    bottom: calc(100% + 1em);
    background: rgba(5, 10, 25, 0.95);
    border: 0.15em solid rgba(0, 255, 204, 0.8);
    border-radius: 0.3em;
    padding: 0.8em;
    color: #c0f0ff;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 1.5em rgba(0, 255, 204, 0.5), inset 0 0 1em rgba(0, 150, 255, 0.4);
    min-width: 16em;
    max-width: 85vw; 
    max-height: 60vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(1em);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}
#chat-ui-b2C3d4E5 .info-panel::-webkit-scrollbar {
    width: 4px;
}
#chat-ui-b2C3d4E5 .info-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 204, 0.5);
    border-radius: 2px;
}
#chat-ui-b2C3d4E5 details[open] .info-panel {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
#chat-ui-b2C3d4E5 details[open] summary .diamond-shape,
#chat-ui-b2C3d4E5 details[open] summary .square-box {
    border-color: #fff;
    box-shadow: 0 0 1.5em rgba(0, 255, 204, 1);
}
#chat-ui-b2C3d4E5 .left-cluster .info-panel { left: 0; transform-origin: bottom left; }
#chat-ui-b2C3d4E5 .right-cluster .info-panel { right: 0; transform-origin: bottom right; }
#chat-ui-b2C3d4E5 .center-cluster .info-panel { left: 50%; transform: translateX(-50%); transform-origin: bottom center; }
#chat-ui-b2C3d4E5 .info-panel h4 {
    color: #00ffcc;
    font-size: 1.1em;
    font-style: italic;
    border-bottom: 1px solid rgba(0, 255, 204, 0.5);
    padding-bottom: 0.3em;
    margin-bottom: 0.5em;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.8);
    transform: skewY(-5deg);
}
#chat-ui-b2C3d4E5 .info-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}
#chat-ui-b2C3d4E5 .info-panel li {
    background: rgba(0, 100, 200, 0.2);
    border-left: 0.2em solid rgba(0, 255, 204, 0.6);
    padding: 0.4em 0.5em;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}
#chat-ui-b2C3d4E5 .info-panel li b {
    color: #fff;
    margin-right: 0.2em;
}
#chat-ui-b2C3d4E5 .divider {
    text-align: center;
    color: rgba(0, 255, 204, 0.8);
    font-weight: bold;
    margin: 0.5em 0;
    letter-spacing: 0.2em;
}
#chat-ui-b2C3d4E5 .memory-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 0.8em;
    background: rgba(0, 20, 40, 0.6);
}
#chat-ui-b2C3d4E5 .memory-table th, 
#chat-ui-b2C3d4E5 .memory-table td {
    border: 1px solid rgba(0, 255, 204, 0.3);
    padding: 0.4em;
    text-align: left;
    word-break: break-word;
}
#chat-ui-b2C3d4E5 .memory-table tr:nth-child(n) {
    background-color: transparent !important;
}
#chat-ui-b2C3d4E5 .memory-table th {
    background: rgba(0, 150, 255, 0.2) !important;
    color: #00ffcc;
    font-weight: bold;
}
#chat-ui-b2C3d4E5 .memory-title {
    color: #fff;
    font-size: 0.9em;
    margin: 0.5em 0 0.2em 0;
    text-shadow: 0 0 3px rgba(0, 150, 255, 0.8);
}
#chat-ui-b2C3d4E5 .quote-box {
    background: rgba(0, 100, 200, 0.15);
    border-left: 0.3em solid #00ffcc;
    padding: 0.6em;
    margin-bottom: 0.8em;
    font-size: 0.85em;
    color: #e0f7fa;
}
#chat-ui-b2C3d4E5 .quote-box b {
    color: #fff;
}

/* 终极移动端防溢出适配 */
@media only screen and (max-width: 768px) {
    #chat-ui-b2C3d4E5 {
        -webkit-text-size-adjust: none; /* 解除移动端浏览器强制字体放大 */
        text-size-adjust: none;
        font-size: 3.3vw !important; /* 核心视口比例绑定 */
        gap: 0.4em !important;
        padding: 0.8em 0.2em !important;
    }
    /* 缩小菱形集群内部占比 */
    #chat-ui-b2C3d4E5 .diamond-cluster {
        grid-template-columns: 2.5em 2.5em 2.5em !important;
        grid-template-rows: 2.5em 2.5em 2.5em !important;
        gap: 0.1em !important;
    }
    #chat-ui-b2C3d4E5 .diamond-shape {
        width: 2.3em !important;
        height: 2.3em !important;
    }
    /* 缩小中间方形集群内部占比 */
    #chat-ui-b2C3d4E5 .center-cluster {
        gap: 0.4em !important;
    }
    #chat-ui-b2C3d4E5 .square-box {
        width: 2.8em !important;
        height: 2.8em !important;
    }
    /* 适配内部文字大小 */
    #chat-ui-b2C3d4E5 .btn-text {
        font-size: 0.68em !important;
    }
    #chat-ui-b2C3d4E5 .center-text {
        font-size: 0.8em !important;
    }
}