/* =========================================
   深渊协议_V7：模拟恐怖 (录像带迷失风 - 修复版)
   ========================================= */

/* 1. 全局重置：老式 CRT 屏幕的失真黑与扫描线 */
.content-wrapper, .content-wrhgcx, .content-wraphfdr {
    font-family: "VCR OSD Mono", "Courier New", monospace, "SimHei"; /* 强制等宽字体或黑体 */
    background-color: #020202;
    color: #e0e0e0;
    /* 模拟老式电视机的横向扫描线底纹 */
    background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px);
    border: 2px solid #222;
    padding: 15px;
    margin-bottom: 15px;
    text-transform: uppercase; /* 英文强制大写，符合OSD规范 */
}

/* 2. 折叠面板：DV摄像机的取景器 UI */
details { margin-bottom: 15px; }

summary {
    cursor: pointer;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 1.1em;
    list-style: none;
    border-bottom: 2px solid #555;
    letter-spacing: 2px;
}
summary::-webkit-details-marker { display: none; }

/* 闭合时像是在快进寻找画面 */
summary::before { content: "► FF : "; color: #00ff00; text-shadow: 0 0 5px #00ff00; }

/* 展开时进入高危录制状态 */
details[open] > summary { border-color: #ff0000; }
details[open] > summary::before {
    content: "● REC : ";
    color: #ff0000;
    text-shadow: 0 0 8px red;
    animation: recBlink 1s infinite steps(2, start);
}
@keyframes recBlink { 50% { opacity: 0; } }

/* 3. 标签异化：录像带的时间戳与频道号 */
aeyh, uyvf, bufx { 
    display: block; 
    margin-bottom: 6px; 
    color: #ccc;
    text-shadow: 1px 0 0 red, -1px 0 0 blue; /* 全局轻微的红蓝3D色差 */
}
aeyh::before { content: "CH 01 | "; color: #fff; }
uyvf::before { content: "SP LP | "; color: #fff; }
bufx::before { content: "TRACK | "; color: #fff; }

/* =========================================
   【已修复】4. 剧情正文区：DV 摄像机全息取景器
   ========================================= */
.content-wrhgcx {
    position: relative;
    border: none; /* 去除原本的左侧白色粗线 */
    padding: 40px 20px 20px 20px; /* 顶部留出空间放播放标识 */
    background: rgba(0, 0, 0, 0.8);
    
    /* 纯CSS手绘 DV 摄像机四个取景框角 (⌜ ⌝ ⌞ ⌟) */
    background-image:
        linear-gradient(#fff, #fff), linear-gradient(#fff, #fff),
        linear-gradient(#fff, #fff), linear-gradient(#fff, #fff),
        linear-gradient(#fff, #fff), linear-gradient(#fff, #fff),
        linear-gradient(#fff, #fff), linear-gradient(#fff, #fff);
    background-repeat: no-repeat;
    background-size:
        15px 2px, 2px 15px, /* 左上角 */
        15px 2px, 2px 15px, /* 右上角 */
        15px 2px, 2px 15px, /* 左下角 */
        15px 2px, 2px 15px; /* 右下角 */
    background-position:
        0 0, 0 0,
        100% 0, 100% 0,
        0 100%, 0 100%,
        100% 100%, 100% 100%;
}

/* 顶部左侧：闪烁的播放状态 */
.content-wrhgcx::before {
    content: "► PLAY";
    position: absolute; top: 10px; left: 15px;
    color: #fff; font-family: monospace; font-size: 14px; letter-spacing: 1px;
    text-shadow: 2px 0 0 red, -2px 0 0 cyan;
    animation: recBlink 2s infinite steps(2, start);
}

/* 顶部右侧：磁带时间码 */
.content-wrhgcx::after {
    content: "SP 0:14:02";
    position: absolute; top: 10px; right: 15px;
    color: #fff; font-family: monospace; font-size: 14px;
    text-shadow: 2px 0 0 red, -2px 0 0 cyan;
}

.content-wrhgcx p { font-size: 16px; margin: 0 0 12px 0; color: #fff; line-height: 1.8; }

/* 📺 核心惊悚点：女诡异对话的“录像带花屏色差” */
.content-wrhgcx p[style*="color"][style*="red" i],
.content-wrhgcx p[style*="color"][style*="FF0000" i] {
    color: #fff !important; /* 强制变白，因为早期录像带字幕没有纯红 */
    font-weight: bold !important;
    background: #000;
    display: inline-block;
    padding: 0 5px;
    /* 强烈的红青双色色差位移，制造极其难受的视觉花屏感 */
    text-shadow: 2px 0 0 red, -2px 0 0 cyan;
    animation: vhsGlitch 0.2s infinite; /* 疯狂抽搐 */
}
@keyframes vhsGlitch {
    0% { text-shadow: 2px 0 0 red, -2px 0 0 cyan; transform: skewX(0deg); }
    25% { text-shadow: -2px 0 0 red, 2px 0 0 cyan; transform: skewX(1deg); }
    50% { text-shadow: 2px 0 0 red, -1px 0 0 cyan; transform: skewX(-1deg); }
    75% { text-shadow: -1px 0 0 red, 2px 0 0 cyan; transform: skewX(0.5deg); }
    100% { text-shadow: 2px 0 0 red, -2px 0 0 cyan; transform: skewX(0deg); }
}

/* =========================================
   【已修复】5. 维生系统 (tinli)：文字防重叠机制
   ========================================= */
tinli {
    display: inline-block;
    position: relative;
    padding-left: 36px; /* 强制用内边距把数字向右推开，给电池留出空位 */
    color: #00ff00; /* VCR 高亮绿 */
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
    vertical-align: middle;
}
/* 电池机身，绝对定位在左侧的留白区域 */
tinli::before {
    content: "";
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 24px; height: 12px;
    border: 2px solid #fff;
    background: #00ff00; 
    box-shadow: inset 0 0 0 2px #000; 
}
/* 电池正极接头 */
tinli::after {
    content: "";
    position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
    width: 2px; height: 6px;
    background: #fff;
}

/* 6. 记忆区表格：系统崩溃的字符转储 */
table { width: 100%; border-collapse: collapse; margin-top: 10px; border: 2px solid #555; }
th, td { border: 1px solid #333; padding: 6px; font-size: 0.9em; }
th { background: #ccc; color: #000; text-align: left; }
td { color: #aaa; text-transform: none; } /* 剧情内容解除大写限制 */

/* 7. 生存抉择：老式磁带机的机械按键 */
.content-wraphfdr { background: #000; border: none; padding: 10px; }
bujko, bujkl, bujng, bujds, bujbv {
    display: block;
    background: #111;
    color: #fff;
    border: 2px solid #555;
    padding: 12px 15px;
    margin: 8px 0;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    box-shadow: 4px 4px 0 #333; /* 粗糙的硬边阴影制造实体按键感 */
    transition: all 0.1s;
}
bujko::before, bujkl::before, bujng::before, bujds::before, bujbv::before { content: "■ STOP : "; color: #888; }
/* 按下/悬停时的物理反馈 */
bujko:hover, bujkl:hover, bujng:hover, bujds:hover, bujbv:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 0 #333;
    transform: translate(4px, 4px); /* 按键被硬生生按下去的视觉效果 */
}
bujko:hover::before, bujkl:hover::before, bujng:hover::before, bujds:hover::before, bujbv:hover::before { 
    content: "► EJECT: "; 
    color: #000; 
}

/* ========== 顶部栏 - 废弃论坛风格 ========== */
.sticky.w-full.top-0.flex.items-center {
  background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%) !important;
  border-bottom: 3px solid #4a4a4a !important;
  box-shadow: 0 2px 0 #000, 0 4px 8px rgba(0,0,0,0.6) !important;
  font-family: 'Courier New', 'Consolas', monospace !important;
}

/* 模型选择器容器 - 旧式下拉框 */
#ai-model-selector .group.flex.items-center {
  background: #3a3a3a !important;
  border: 2px outset #5a5a5a !important;
  border-radius: 0 !important;
  box-shadow: inset -1px -1px 0 #222, inset 1px 1px 0 #4a4a4a !important;
  transition: all 0.15s ease !important;
}

#ai-model-selector .group.flex.items-center:hover {
  background: #4a4a4a !important;
  border-style: inset !important;
  animation: glitch 0.3s infinite !important;
}

/* 模型名称文字 - 怪谈红色 */
#ai-model-selector .truncate.text-\[13px\] {
  color: #ff4444 !important;
  text-shadow: 0 0 3px rgba(255, 68, 68, 0.5), 1px 1px 0 #000 !important;
  font-weight: bold !important;
  letter-spacing: 0.5px !important;
}

/* 下拉箭头 */
#ai-model-selector .shrink-0.flex.items-center svg {
  filter: drop-shadow(0 0 2px #ff4444) !important;
  transition: transform 0.2s !important;
}

#ai-model-selector .group.flex.items-center:hover svg {
  transform: rotate(180deg) !important;
}

/* 历史记录图标 - 闪烁效果 */
.sticky.w-full.top-0 svg.lucide-clock-8 {
  filter: drop-shadow(0 0 4px #00ff00) !important;
  animation: blink 2s infinite !important;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 99% { opacity: 0.3; }
}

/* 未读角标 - 血红警示 */
.sticky.w-full.top-0 span.MuiBadge-dot.md\:hidden {
  background: #ff0000 !important;
  box-shadow: 0 0 6px #ff0000, inset 0 0 3px #000 !important;
  animation: pulse 1.5s infinite !important;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* 设置按钮 - 旧式方形按钮 */
#header-setting-button {
  background: #3a3a3a !important;
  border: 2px outset #5a5a5a !important;
  border-radius: 0 !important;
  box-shadow: 2px 2px 0 #000 !important;
}

#header-setting-button:hover {
  border-style: inset !important;
  box-shadow: inset 2px 2px 4px #000 !important;
  background: #2a2a2a !important;
}

#header-setting-button svg {
  filter: brightness(0.8) contrast(1.2) !important;
}

/* ========== 底部栏 - 废弃输入区 ========== */
#ai-chat-bottom-input {
  background: #2a2a2a !important;
  border: 3px double #4a4a4a !important;
  border-radius: 0 !important;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.7), 0 -2px 0 #000 !important;
}

/* 主输入框 - 绿色终端风 */
#ai-chat-input {
  background: #1a1a1a !important;
  color: #00ff00 !important;
  border: 2px inset #333 !important;
  border-radius: 0 !important;
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-size: 14px !important;
  text-shadow: 0 0 2px rgba(0, 255, 0, 0.3) !important;
  padding: 8px !important;
}

#ai-chat-input::placeholder {
  color: #006600 !important;
  text-shadow: none !important;
  font-style: italic !important;
}

#ai-chat-input::selection {
  background: #00ff00 !important;
  color: #000 !important;
}

#ai-chat-input:focus {
  outline: 2px solid #ff4444 !important;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.5) !important;
  animation: flicker 0.1s infinite !important;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* ========== 底部按钮 - 规则怪谈按钮 ========== */
#ai-mod-button2 button.MuiButton-root {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%) !important;
  color: #ffffff !important;
  border: 2px outset #5a5a5a !important;
  border-radius: 0 !important;
  box-shadow: 2px 2px 0 #000, inset -1px -1px 0 #222 !important;
  font-family: 'Courier New', 'Consolas', monospace !important;
  font-weight: bold !important;
  text-shadow: 1px 1px 2px #000 !important;
  transition: all 0.1s ease !important;
}

#ai-mod-button2 button.MuiButton-root:hover {
  background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%) !important;
  border-style: inset !important;
  box-shadow: inset 2px 2px 4px #000 !important;
  color: #ff4444 !important;
  text-shadow: 0 0 4px rgba(255, 68, 68, 0.8), 1px 1px 0 #000 !important;
  transform: translate(1px, 1px) !important;
}

#ai-mod-button2 button.MuiButton-root svg {
  filter: drop-shadow(0 0 2px currentColor) !important;
}

/* 故障效果关键帧 */
@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0); }
}

/* 1. 为顶部栏添加扫描线效果 */
.sticky.w-full.top-0.flex.items-center::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

/* 2. 为输入框添加CRT屏幕弧度光晕 */
#ai-chat-input::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

/* 3. 为按钮添加随机故障文字效果 */
#ai-mod-button2 button.MuiButton-root:active {
  animation: textGlitch 0.2s 1 !important;
}

@keyframes textGlitch {
  0%, 100% { text-shadow: 1px 1px 2px #000; }
  25% { text-shadow: -2px 0 #ff0000, 2px 0 #00ff00; }
  50% { text-shadow: 2px 0 #ff0000, -2px 0 #0000ff; }
  75% { text-shadow: 0 -2px #ff0000, 0 2px #00ff00; }
}

/* 隐藏平台默认的顶部颜色装饰条 */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 统一聊天框：废弃论坛 + 规则怪谈风格 */
.bg-gray-100\/90.relative.inline-block {
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%) !important;
    border: 2px solid #3a3a3a !important;
    border-radius: 4px !important;
    box-shadow: 
        inset 0 0 20px rgba(255, 0, 0, 0.05),
        0 0 15px rgba(0, 0, 0, 0.8),
        0 4px 0 #000000,
        0 6px 8px rgba(0, 0, 0, 0.6) !important;
    padding: 16px !important;
    position: relative !important;
    isolation: isolate !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
}

/* 扫描线效果（复古CRT显示器） */
.bg-gray-100\/90.relative.inline-block::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='4'%3E%3Crect width='100' height='1' fill='%23000'/%3E%3Crect y='2' width='100' height='1' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E") repeat !important;
    pointer-events: none !important;
    z-index: 0 !important;
    opacity: 0.6 !important;
}

/* 随机故障闪烁效果 */
.bg-gray-100\/90.relative.inline-block::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 0, 0, 0.05) 50%, transparent 100%) !important;
    pointer-events: none !important;
    z-index: 0 !important;
    opacity: 0 !important;
    background-size: 200% 100% !important;
    animation: glitch-flicker 8s infinite !important;
}

@keyframes glitch-flicker {
    0%, 90%, 100% { opacity: 0; background-position: 0% 0%; }
    91% { opacity: 0.3; background-position: 100% 0%; }
    92% { opacity: 0; }
    93% { opacity: 0.4; background-position: 50% 0%; }
    94%, 100% { opacity: 0; }
}

/* 主要文本内容：高对比度绿色磷光字体（复古终端风格） */
.markdown-body {
    color: #33ff33 !important;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background: transparent !important;
    position: relative !important;
    z-index: 1 !important;
    text-shadow: 0 0 3px rgba(51, 255, 51, 0.5) !important;
}

/* 强调文本：红色警告色 */
.markdown-body strong,
.markdown-body b {
    color: #ff3333 !important;
    font-weight: bold !important;
    text-shadow: 0 0 4px rgba(255, 51, 51, 0.6) !important;
}

/* 链接：黄色警告 */
.markdown-body a {
    color: #ffcc00 !important;
    text-decoration: underline !important;
    text-shadow: 0 0 3px rgba(255, 204, 0, 0.5) !important;
}

/* 代码块：更深的背景 */
.markdown-body code,
.markdown-body pre {
    background: #000000 !important;
    border: 1px solid #333333 !important;
    color: #00ff00 !important;
    font-family: 'Courier New', monospace !important;
}

/* 底部操作按钮：复古样式 */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
    color: #999999 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border: 1px solid #444444 !important;
    border-radius: 2px !important;
    padding: 4px 8px !important;
    background: #1a1a1a !important;
    transition: all 0.2s !important;
}

.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary:hover {
    color: #ff3333 !important;
    border-color: #ff3333 !important;
    background: #0d0d0d !important;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.3) !important;
}

/* 模型名称文本 */
.MuiTypography-root.MuiTypography-body2.css-6c0gf2 {
    color: #666666 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
}

/* Token消耗文本 */
.text-orange-500 {
    color: #ff6600 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 12px !important;
}

/* 隐藏默认加载动画 */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}

/* 自定义加载动画容器 */
.flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    width: 100% !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 规则怪谈风格加载动画：闪烁的警告符号（使用SVG SMIL） */
.flex.items-center.justify-center.w-6.h-5::before {
    content: '' !important;
    position: absolute !important;
    width: 40px !important;
    height: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,10 90,80 10,80' fill='none' stroke='%23ff3333' stroke-width='3'%3E%3Canimate attributeName='opacity' values='1;0.3;1;0.3;1' dur='1.5s' repeatCount='indefinite'/%3E%3C/polygon%3E%3Ctext x='50' y='70' font-family='monospace' font-size='40' fill='%23ff3333' text-anchor='middle' font-weight='bold'%3E!%3Canimate attributeName='opacity' values='0.3;1;0.3;1;0.3' dur='1.5s' repeatCount='indefinite'/%3E%3C/text%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%23ffcc00' stroke-width='1' opacity='0.3'%3E%3Canimate attributeName='r' values='45;48;45' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' values='0.3;0.6;0.3' dur='2s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    z-index: 1 !important;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .flex.items-center.justify-center.w-6.h-5::before {
        width: 32px !important;
        height: 32px !important;
    }
    
    .bg-gray-100\/90.relative.inline-block {
        padding: 12px !important;
    }
    
    .markdown-body {
        font-size: 13px !important;
    }
}

/* 降低动效（无障碍） */
@media (prefers-reduced-motion: reduce) {
    .bg-gray-100\/90.relative.inline-block::after {
        animation-duration: 15s !important;
    }
    
    /* SVG动画已在data URI中内嵌，浏览器会自动处理降低动效偏好 */
}

.markdown-body {
    text-shadow: none !important;
}