/*
 * 名称: 崩坏科技风 UI
 * 作者: 多功能创作引擎
 * 描述: 浅色科幻主题，适用于“崩坏”等世界观。具有毛玻璃、网格背景和响应式布局。
 */

ai {
  /* --- 配色与主题变量 --- */
  --bg: #0A0F1A; /* 外部背景色（参考） */
  --panel-bg: rgba(18, 28, 48, 0.75); /* 面板背景 */
  --accent: #38B6FF; /* 主强调色/高亮 */
  --warn: #FFC700; /* 警告色 */
  --danger: #F85149; /* 危险色 */
  --text: #E2E8F0; /* 主要文本 */
  --text-muted: #8A9CB3; /* 次要文本/标题 */
  --border-color: rgba(56, 182, 255, 0.25); /* 边框/分隔线 */
  --grid-bg: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%231a2a45' fill-opacity='0.3' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E"); /* 微妙的网格背景图案 */

  /* --- 根容器与入场动画 --- */
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  padding: 8px;
  animation: panelFadeIn 0.5s ease-out forwards;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 主标题 --- */
ai hd {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
  padding-left: 12px;
  position: relative;
  text-shadow: 0 0 8px rgba(56, 182, 255, 0.5);
}
ai hd::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 5px var(--accent);
}

/* --- AI叙事内容区 --- */
ai article {
  margin-bottom: 16px;
}
ai article p {
  margin: 0;
  padding: 0;
}

/* --- 主状态面板 --- */
ai details {
  background-color: var(--panel-bg);
  background-image: var(--grid-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 15px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

/* --- 面板折叠标题 (STATUS) --- */
ai summary {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 15px;
  cursor: pointer;
  list-style: none;
  transition: color 0.2s ease;
  outline: none;
}
ai summary:hover {
  color: var(--accent);
}
ai summary::-webkit-details-marker {
  display: none;
}

/* --- 信息分区 --- */
ai p[t] {
  margin: 0 0 16px 0;
  padding: 18px 0 0 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 12px;
  border-top: 1px solid rgba(138, 156, 179, 0.15);
}
ai details > p[t]:first-of-type {
  padding-top: 0;
  border-top: none;
}
ai p[t]::before {
  content: attr(t);
  position: absolute;
  top: -10px;
  left: 0;
  background: var(--panel-bg);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- 数据项 --- */
ai d {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border-left: 2px solid var(--border-color);
  transition: background 0.2s ease, transform 0.2s ease;
  min-height: 28px;
}
ai d:hover {
  background: rgba(56, 182, 255, 0.15);
  transform: translateY(-1px);
}
ai d[g="full"] {
  grid-column: 1 / -1;
}

/* --- 特殊高亮值 --- */
ai v {
  font-weight: 600;
  padding-left: 4px;
}
ai v[c="h"] { color: var(--accent); }
ai v[c="w"] { color: var(--warn); }
ai v[c="d"] { color: var(--danger); }

/* --- 标签 --- */
ai tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}
ai tg {
  font-size: 11px;
  background: rgba(56, 182, 255, 0.1);
  color: #a5d8ff;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: default;
}
ai tg:hover {
  background: rgba(56, 182, 255, 0.25);
  color: #dbeafe;
  border-color: var(--accent);
}

/* ==========================================================================
   聊天框主题（已修复：状态栏/按钮/加载动画 100% 显示）
=========================================================================== */

/* --- 移除顶部装饰条 --- */
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* --- 动画 --- */
@keyframes techScanline {
  0% { background-position: 0% 0; }
  100% { background-position: 100% 0; }
}

/* --- 聊天框主容器 --- */
div[class*="gray-100"].relative.inline-block {
    --panel-bg: rgba(18, 28, 48, 0.75);
    --accent: #38B6FF;
    --warn: #FFC700;
    --text: #E2E8F0;
    --text-muted: #8A9CB3;
    --border-color: rgba(56, 182, 255, 0.25);
    --grid-bg: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%231a2a45' fill-opacity='0.3' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");

    background: var(--panel-bg) var(--grid-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4) !important;
    transition: all 0.3s ease !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif !important;
    padding: 12px 15px !important;
    color: var(--text) !important;
    position: relative;
    z-index: 0;
}

/* --- 背景扫描线（修复层级：不会覆盖状态栏） --- */
div[class*="gray-100"].relative.inline-block::before {
    content: '' !important;
    position: absolute !important;
    left:0 !important; top:0 !important;
    width:100% !important; height:100% !important;
    background: linear-gradient(90deg, transparent 0%, rgba(56, 182, 255, 0.1) 50%, transparent 100%) !important;
    background-size: 200% 100% !important;
    animation: techScanline 8s linear infinite !important;
    pointer-events: none !important;
    z-index: -2 !important; /* 关键修复：放在最底层 */
    opacity: 0.3 !important;
}

/* --- 文本内容 --- */
.markdown-body {
    background: transparent !important;
    color: var(--text) !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* --- 底部状态栏（完全可见、可点击） --- */
div[class*="gray-100"] .absolute.bottom-0 {
    position: relative !important;
    margin-top: 12px !important;
    z-index: 999 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- 按钮 --- */
button[class*="MuiButton-textPrimary"] {
    color: #EAEAEA !important;
    font-size: 13px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    background: rgba(0,0,0,0.2) !important;
    transition: 0.2s !important;
    z-index: 9999 !important;
    position: relative !important;
}
button[class*="MuiButton-textPrimary"]:hover {
    background: rgba(56,182,255,0.15) !important;
    color: var(--accent) !important;
}

/* --- 模型名 / token --- */
[class*="MuiTypography-body2"],
.text-orange-500 {
    color: var(--text) !important;
    opacity: 1 !important;
    z-index: 999 !important;
    position: relative !important;
}
.text-orange-500 { color: var(--warn) !important; }

/* --- 加载动画（正常显示） --- */
[class*="dot-flashing"] { display: none !important; }

.flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    width: 24px !important;
    height: 24px !important;
    z-index: 9999 !important;
}
.flex.items-center.justify-center.w-6.h-5::before,
.flex.items-center.justify-center.w-6.h-5::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}
.flex.items-center.justify-center.w-6.h-5::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cline x1='4' y1='12' x2='20' y2='12' stroke='%2338B6FF' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='1.5s' repeatCount='indefinite'/%3E%3C/line%3E%3C/svg%3E") !important;
}
.flex.items-center.justify-center.w-6.h-5::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cline x1='4' y1='12' x2='20' y2='12' stroke='%2338B6FF' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='90 12 12' to='450 12 12' dur='1.5s' repeatCount='indefinite'/%3E%3C/line%3E%3C/svg%3E") !important;
}

/* --- 移动端 --- */
@media (max-width: 480px) {
    div[class*="gray-100"].relative.inline-block {
        border-radius: 6px !important;
        padding: 8px 10px !important;
    }
}