/* ========================================
   《球星传奇》专属聊天框美化 (Hoop Legend UI)
   ======================================== */

/* 1. 强制隐藏顶部破坏氛围的颜色装饰条 */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 2. 统一聊天框基础样式 (深邃球场黑 + 聚光灯渐变) */
.bg-gray-100\/90.relative.inline-block {
    background-color: #161616 !important;
    background-image: radial-gradient(circle at top right, #2a1610 0%, #161616 60%) !important;
    border: 1px solid #333 !important;
    border-left: 4px solid #ff6b00 !important; /* 篮球橙左侧高亮边框 */
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7) !important;
    padding: 16px !important;
    transition: all 0.3s ease !important;
}

/* 3. 区分玩家输入框 (略微不同的边框颜色) */
.bg-gray-100\/90.relative.inline-block:not(.chat-answer-container .bg-gray-100\/90) {
    border-left: 4px solid #d90429 !important; /* 热火红 */
    background-image: radial-gradient(circle at top left, #2b0a0a 0%, #161616 60%) !important;
}

/* 4. 【强制可读性】主文本样式 (深色底必须配高对比度浅色字) */
.markdown-body {
    color: #F0F0F0 !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    font-weight: 500 !important;
    line-height: 1.7 !important;
    text-shadow: none !important; /* 严禁文字阴影影响阅读 */
    background: transparent !important;
    z-index: 1 !important;
    position: relative !important;
}

/* 5. 底部附加元素适配 (按钮、模型名、Token消耗) */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary,
.MuiTypography-root.MuiTypography-body2.css-6c0gf2,
.text-orange-500 {
    color: #b0b0b0 !important; /* 浅灰色，既能看清又不抢正文风头 */
    font-weight: bold !important;
}

/* ========================================
   巨型赛事转播级加载动画 (Loading Screen)
   ======================================== */

/* 隐藏默认的三个小圆点 */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}

/* 重构加载容器：撑开为一个巨大的面板 */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    width: 100% !important;
    min-width: 280px !important;
    max-width: 600px !important; /* 限制最大宽度，防止在PC端过大 */
    height: 350px !important; /* 设定巨大高度 */
    margin: 10px auto !important;
    display: flex !important;
    flex-direction: column !important;
    background-color: #0a0a0a !important;
    border: 2px solid #ff6b00 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 0 25px rgba(255, 107, 0, 0.2) !important;
}

/* 使用 ::before 镶嵌用户指定的图片 (居中、原比例) */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 90px) !important; /* 留出底部90px给进度条和文字 */
    background-image: url('https://catai.wiki/483b1498-aa41-42bd-c5f8-bafeb134b700/w=3000') !important;
    background-size: contain !important; /* 确保图片完整显示不被裁剪 */
    background-position: center center !important;
    background-repeat: no-repeat !important;
    border-bottom: 2px dashed #333 !important;
    background-color: #121212 !important; /* 图片未覆盖区域的底色 */
}

/* 使用 ::after 结合 SVG Data URI 绘制动态进度条和提示文字 */
/* 包含 SMIL 动画，确保在 CSS 动画被禁用时依然有效 */
.chat-answer-container .flex.items-center.justify-center.w-6.h-5::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 90px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 90' width='100%25' height='100%25'%3E%3Crect x='10%25' y='15' width='80%25' height='6' fill='%23333' rx='3'/%3E%3Crect x='10%25' y='15' width='0' height='6' fill='%23ff6b00' rx='3'%3E%3Canimate attributeName='width' from='0' to='80%25' dur='2s' repeatCount='indefinite'/%3E%3C/rect%3E%3Ctext x='50%25' y='48' font-family='sans-serif' font-size='15' fill='%23e0e0e0' text-anchor='middle' font-weight='bold'%3E建议2到4游玩记忆，下方有快捷键，按需使用。%3C/text%3E%3Ctext x='50%25' y='72' font-family='sans-serif' font-size='13' fill='%23d90429' text-anchor='middle' font-style='italic' font-weight='900' letter-spacing='3'%3ELOADING COURT DATA...%3C/text%3E%3C/svg%3E") !important;
    background-size: cover !important;
    background-position: center !important;
    background-color: #0a0a0a !important;
}

/* 移动端微调 */
@media (max-width: 480px) {
    .chat-answer-container .flex.items-center.justify-center.w-6.h-5 {
        height: 280px !important; /* 手机端稍微降低高度 */
    }
    .chat-answer-container .flex.items-center.justify-center.w-6.h-5::before {
        height: calc(100% - 75px) !important;
    }
    .chat-answer-container .flex.items-center.justify-center.w-6.h-5::after {
        height: 75px !important;
        /* 手机端稍微缩小SVG内的字体 */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 90' width='100%25' height='100%25'%3E%3Crect x='10%25' y='15' width='80%25' height='6' fill='%23333' rx='3'/%3E%3Crect x='10%25' y='15' width='0' height='6' fill='%23ff6b00' rx='3'%3E%3Canimate attributeName='width' from='0' to='80%25' dur='2s' repeatCount='indefinite'/%3E%3C/rect%3E%3Ctext x='50%25' y='48' font-family='sans-serif' font-size='18' fill='%23e0e0e0' text-anchor='middle' font-weight='bold'%3E建议2到4游玩记忆，下方有快捷键，按需使用。%3C/text%3E%3Ctext x='50%25' y='75' font-family='sans-serif' font-size='15' fill='%23d90429' text-anchor='middle' font-style='italic' font-weight='900' letter-spacing='2'%3ELOADING COURT DATA...%3C/text%3E%3C/svg%3E") !important;
    }
}

ai {
  --bg-dark: #121212;
  --bg-panel: #1e1e1e;
  --text-main: #e0e0e0;
  --hoop-orange: #ff6b00;
  --heat-red: #d90429;
  --glory-gold: #ffd700;
  --court-wood: #d4a373;
  --neon-green: #39ff14;
  
  display: block;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 0%, #2a1610 0%, transparent 70%);
  color: var(--text-main);
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  border: 1px solid #333;
}

/* 杂志风标题栏 */
ai summary {
  background: linear-gradient(135deg, var(--heat-red), var(--hoop-orange));
  color: #fff;
  padding: 10px 15px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  list-style: none;
  border-left: 8px solid var(--glory-gold);
  margin-bottom: 8px;
  border-radius: 4px 8px 8px 4px;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  transition: transform 0.1s;
}
ai summary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0px rgba(0,0,0,0.5); }
ai summary::-webkit-details-marker { display: none; }

/* 计分板特化 (巨大醒目) */
ai .scoreboard summary {
  background: #000;
  color: var(--hoop-orange);
  border-left: 8px solid var(--hoop-orange);
  text-shadow: 0 0 8px var(--hoop-orange);
  font-size: 1.1em;
  letter-spacing: 2px;
}
ai .scoreboard .bx {
  background: #050505;
  border: 3px solid #222;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.9);
  position: relative;
}
ai .scoreboard .bx::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.3) 2px, rgba(0,0,0,0.3) 4px);
  pointer-events: none;
}
ai .scoreboard .bx d span {
  font-size: 2.8em;
  font-weight: 900;
  color: var(--glory-gold);
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  font-family: 'Courier New', Courier, monospace;
  display: inline-block;
  margin: 0 15px;
  line-height: 1;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.85; } 100% { opacity: 1; } }

/* 场地侦测 */
ai .env .bx, ai .env g {
  background: rgba(212, 163, 115, 0.1); /* 木地板色调微透 */
  border-left: 3px solid var(--court-wood);
}

/* 动作检定 (红黑警告风) */
ai .resolution .bx {
  background: repeating-linear-gradient(-45deg, #2b0a0a, #2b0a0a 10px, #1a0505 10px, #1a0505 20px);
  border: 2px solid var(--heat-red);
  color: #ffcccc;
  box-shadow: 0 0 10px rgba(217, 4, 41, 0.3);
}

/* 社交媒体 (反转浅色底) */
ai .media .bx {
  background: #f4f4f9;
  color: #1a1a1a;
  border-left: 5px solid #1da1f2; /* Twitter蓝 */
  border-radius: 8px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}
ai .media f { color: #1da1f2; font-weight: 900; }
ai .media li { color: #333; border-bottom: 1px dashed #ccc; padding-bottom: 4px; }

/* 战术板 (墨绿底白线) */
ai .act .bx, ai .act ol {
  background: #1b4d3e;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 6px;
  padding: 12px;
  background-image: 
    linear-gradient(rgba(255,255,255,0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 20px 20px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
ai .act ol li { font-weight: bold; margin-bottom: 8px; }

/* 通用排版与容器 */
ai g {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  background: rgba(255,255,255,0.03);
  padding: 10px;
  border-radius: 6px;
  margin: 6px 0;
}
ai .bx {
  background: var(--bg-panel);
  border: 1px solid #333;
  padding: 12px;
  margin: 8px 0;
  border-radius: 6px;
  border-left: 4px solid var(--hoop-orange);
}
ai d { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
ai d:last-child { border-bottom: none; }
ai f { font-weight: bold; color: #aaa; font-size: 0.9em; }
ai b, ai .fw { color: var(--hoop-orange); font-weight: 900; }

/* 列表项 (篮球Emoji Bullet) */
ai li {
  margin-bottom: 5px;
  padding-left: 18px;
  position: relative;
  list-style: none;
  font-size: 0.95em;
}
ai li::before {
  content: '🏀';
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 11px;
  filter: drop-shadow(1px 1px 0px #000);
}

/* 正文区域 */
ai txt {
  display: block;
  background: #181818;
  padding: 18px;
  border-radius: 4px;
  border-top: 3px solid var(--hoop-orange);
  border-bottom: 3px solid var(--hoop-orange);
  margin: 15px 0;
  font-size: 15px;
  color: #e8e8e8;
  text-align: justify;
  line-height: 1.8;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

/* 规则警告 */
ai mr {
  display: block;
  background: rgba(217, 4, 41, 0.15);
  border-left: 4px solid var(--heat-red);
  padding: 8px;
  font-size: 0.85em;
  color: #ff9999;
  margin-bottom: 8px;
}
ai hr { border: 0; height: 1px; background: linear-gradient(to right, transparent, #555, transparent); margin: 15px 0; }