/* =========================================
   【放学后的广播室】 - 清新青春校园风 完整版 UI
   风格：薄荷绿 / 动态晨风 / 聊天气泡 / 毛玻璃
========================================= */

/* =========================================
   1. 全局动态背景 (初夏晨风与树荫光影)
========================================= */
body, #bg_layer {
    /* 增加动态渐变，模拟微风吹拂时光影的流转 */
    background: linear-gradient(120deg, #e6f9ec 0%, #f3fdf7 30%, #e0f7fa 70%, #e6f9ec 100%) !important;
    background-size: 200% 200% !important;
    background-attachment: fixed !important;
    animation: morning-breeze 15s ease infinite !important;
}

@keyframes morning-breeze {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =========================================
   2. 鼠标框选文本美化 (Selection Highlight)
========================================= */
::selection {
    background: rgba(52, 211, 153, 0.4) !important; /* 半透明翠绿背景 */
    color: #064e3b !important; /* 极深的墨绿色文字 */
    text-shadow: none !important;
}
::-moz-selection {
    background: rgba(52, 211, 153, 0.4) !important;
    color: #064e3b !important;
}

/* =========================================
   3. 正文对话框美化 (区分 AI 与 玩家 的气泡)
========================================= */
.mes {
    background: rgba(255, 255, 255, 0.75) !important; 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(167, 243, 208, 0.5) !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.06), inset 0 0 10px rgba(255,255,255,0.6) !important;
    margin-bottom: 24px !important;
    padding: 20px 24px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mes:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.12), inset 0 0 10px rgba(255,255,255,0.8) !important;
}

.mes_text {
    color: #374151 !important;
    font-size: 1.05em !important;
    line-height: 1.8 !important;
    font-family: 'Nunito', 'Microsoft YaHei', 'PingFang SC', sans-serif !important;
}

/* 🎤 AI 角色发言框 (左侧带薄荷绿书签带，非对称气泡) */
.mes[is_user="false"], .ch_mes {
    border-left: 4px solid #34d399 !important;
    border-radius: 4px 24px 24px 24px !important; /* 左上角尖锐，模拟聊天气泡 */
}

/* 🎧 玩家发言框 (右侧带浅青色书签带，微弱的背景色区分) */
.mes[is_user="true"], .user_mes {
    border-right: 4px solid #6ee7b7 !important;
    border-radius: 24px 4px 24px 24px !important; /* 右上角尖锐 */
    background: rgba(240, 253, 244, 0.8) !important; /* 稍微偏绿一点的底色 */
}

/* =========================================
   4. AI 回复等待动画美化 (Loading / Typing)
========================================= */
/* 等待提示框本体 (如 SillyTavern 的 Swipe/Loading 提示) */
#mes_info, .typing_indicator_container {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(8px);
    border: 2px dashed #6ee7b7 !important; /* 虚线边框显得俏皮 */
    border-radius: 20px !important;
    color: #059669 !important;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2) !important;
    padding: 10px 20px !important;
}

/* 正在输入的跳动圆点 (Typing Dots) */
.typing_indicator span, .typing-dot {
    background-color: #10b981 !important; /* 翠绿色的点 */
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6) !important;
    animation: typing-bounce 1.4s infinite ease-in-out both !important;
}

.typing_indicator span:nth-child(1) { animation-delay: -0.32s !important; }
.typing_indicator span:nth-child(2) { animation-delay: -0.16s !important; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* =========================================
   5. 状态栏容器 (电台播报卡片)
========================================= */
details {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #a7f3d0;
    border-radius: 16px;
    margin: 16px 0;
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.1);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

details:hover {
    border-color: #6ee7b7;
    box-shadow: 0 6px 16px rgba(52, 211, 153, 0.2);
}

/* 状态栏标题 */
summary {
    background: linear-gradient(to right, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
    font-weight: bold;
    font-size: 1.05em;
    padding: 14px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

summary::-webkit-details-marker { display: none; }
summary::before {
    content: "🍀"; 
    margin-right: 10px;
    font-size: 1.1em;
    filter: drop-shadow(0 2px 2px rgba(4, 120, 87, 0.2));
    transition: transform 0.3s ease;
}

/* 展开时的标题栏 (ON AIR) */
details[open] summary {
    background: linear-gradient(to right, #34d399 0%, #10b981 100%);
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

details[open] summary::before {
    content: "🎙️";
    transform: scale(1.1);
}

details[open] summary::after {
    content: "• ON AIR";
    margin-left: auto;
    font-size: 0.8em;
    font-weight: 900;
    color: #fff;
    background: #059669;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% { opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.8); }
    50% { opacity: 0.6; box-shadow: 0 0 2px rgba(16, 185, 129, 0.3); }
    100% { opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.8); }
}

/* =========================================
   6. 面板内部内容 & 列表美化
========================================= */
details > *:not(summary) { padding: 0 20px; margin-top: 12px; margin-bottom: 12px; color: #4b5563; }
details strong {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

details ul { padding-left: 0; list-style-type: none; }
details ul li {
    background: #f0fdf4;
    border: 1px solid #d1fae5;
    border-left: 4px solid #34d399;
    margin-bottom: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    color: #374151;
    font-size: 0.95em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}
details ul li:hover { transform: translateX(4px); background: #e6fcf5; }

/* 记忆区表格 */
details table {
    width: 100%; border-collapse: hidden; border-radius: 10px; overflow: hidden; margin: 15px 0; box-shadow: 0 0 0 1px #a7f3d0;
}
details th { background: #6ee7b7; color: #064e3b; padding: 12px; font-weight: 600; text-align: left; }
details td { padding: 10px 12px; background: #fff; border-bottom: 1px solid #ecfdf5; color: #4b5563; font-size: 0.9em; }
details tr:nth-child(even) td { background: #f3fdf7; }
details tr:hover td { background: #d1fae5; }
details hr { border: 0; height: 2px; background: dotted #6ee7b7; margin: 15px 0; }

/* =========================================
   7. 按键与行动选项 (Galgame 选择肢)
========================================= */
details:last-of-type ul li, .action-options li {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(236, 253, 245, 0.9) 100%);
    border: 2px solid #a7f3d0;
    border-radius: 999px;
    text-align: center;
    padding: 12px 20px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #059669;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(52, 211, 153, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
details:last-of-type ul li:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white; border-color: transparent;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}
details:last-of-type ul li:active { transform: translateY(1px) scale(0.98); }

/* 全局通用按钮 */
button, .btn {
    background: linear-gradient(to right, #6ee7b7 0%, #34d399 100%);
    color: #fff !important; border: none !important; border-radius: 12px !important;
    padding: 8px 16px; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 10px rgba(52, 211, 153, 0.3) !important;
    transition: all 0.2s ease;
}
button:hover, .btn:hover {
    filter: brightness(1.05); transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 211, 153, 0.5) !important;
}

/* 对话框内部小控制按键 */
.mes_button, .swipe-right, .swipe-left {
    background: rgba(255, 255, 255, 0.8) !important; backdrop-filter: blur(4px);
    color: #34d399 !important; border-radius: 50% !important;
    width: 32px !important; height: 32px !important;
    display: inline-flex !important; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(52, 211, 153, 0.15) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
.mes_button:hover, .swipe-right:hover, .swipe-left:hover {
    background: #10b981 !important; color: white !important;
    transform: scale(1.15) rotate(8deg) !important;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4) !important;
}

/* 主发送按键 (纸飞机) */
#send_but {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
    border-radius: 20px !important; width: 45px !important; height: 45px !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}
#send_but:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5) !important;
    animation: breeze-float 1.5s ease-in-out infinite alternate;
}
@keyframes breeze-float {
    0% { transform: scale(1.05) translateY(-2px); }
    100% { transform: scale(1.05) translateY(-5px); }
}
/* =========================================
   1. 底部输入区总容器 (包裹输入框和按钮的外壳)
========================================= */
#chat_input, .chat-input-container, #bottom-bar {
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(167, 243, 208, 0.5) !important;
    border-radius: 24px 24px 0 0 !important; /* 顶部大圆角 */
    box-shadow: 0 -8px 24px rgba(16, 185, 129, 0.08) !important;
    padding: 12px !important;
    transition: all 0.3s ease;
}

/* =========================================
   2. 玩家输入文本框本体 (Textarea)
========================================= */
#send_textarea, .text_pole {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 2px solid transparent !important; /* 默认无边框 */
    border-radius: 18px !important; /* 圆润的输入框 */
    color: #374151 !important; /* 深灰绿文字 */
    font-size: 1.05em !important;
    line-height: 1.6 !important;
    padding: 14px 18px !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.03) !important; /* 微弱的内阴影，增加凹陷质感 */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    
    /* 将打字的光标变成翠绿色 */
    caret-color: #10b981 !important; 
}

/* 占位符文字 (Placeholder) 美化 */
#send_textarea::placeholder, .text_pole::placeholder {
    color: #9ca3af !important;
    font-style: italic; /* 斜体显得更随性 */
    opacity: 0.7;
}

/* =========================================
   3. 输入框激活状态 (Focus - 正在输入时)
========================================= */
#send_textarea:focus, .text_pole:focus {
    background: #ffffff !important; /* 纯白高亮底色 */
    border-color: #6ee7b7 !important; /* 浮现薄荷绿边框 */
    /* 产生两层光晕：一层薄荷绿外发光，一层内阴影 */
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2), inset 0 2px 6px rgba(0,0,0,0.02) !important;
    outline: none !important;
    transform: translateY(-1px); /* 微微上浮 */
}

/* =========================================
   4. 全局滚动条美化 (Scrollbar)
   (替换掉浏览器默认丑陋的灰色宽滚动条)
========================================= */
::-webkit-scrollbar {
    width: 8px !important;  /* 竖向滚动条宽度 */
    height: 8px !important; /* 横向滚动条高度 */
}

/* 滚动条滑道背景 */
::-webkit-scrollbar-track {
    background: rgba(236, 253, 245, 0.4) !important; /* 极淡的抹茶色 */
    border-radius: 10px !important;
}

/* 滚动条滑块本体 */
::-webkit-scrollbar-thumb {
    background: #a7f3d0 !important; /* 薄荷绿 */
    border-radius: 10px !important;
    border: 2px solid rgba(255,255,255,0.5); /* 增加一点白边显得更精致 */
}

/* 鼠标悬停在滚动条上时 */
::-webkit-scrollbar-thumb:hover {
    background: #34d399 !important; /* 变深为亮翠绿 */
}
/* =========================================
   强制生效版：背景与正文美化
========================================= */

/* 1. 强制全局背景 (包裹整个回复的动态背景框) */
.campus-theme-bg {
    background: linear-gradient(120deg, #e6f9ec 0%, #f3fdf7 30%, #e0f7fa 70%, #e6f9ec 100%) !important;
    background-size: 200% 200% !important;
    animation: morning-breeze 15s ease infinite !important;
    padding: 20px !important;
    border-radius: 16px !important;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.5) !important;
    margin-bottom: 20px;
}

/* 2. 强制正文气泡框 (包裹叙事文本的容器) */
.narrative-box {
    background: rgba(255, 255, 255, 0.85) !important; 
    backdrop-filter: blur(12px) !important; 
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(167, 243, 208, 0.6) !important;
    border-left: 5px solid #34d399 !important; /* 左侧薄荷绿书签带 */
    border-radius: 4px 24px 24px 24px !important; /* 聊天气泡形状 */
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.08), inset 0 0 10px rgba(255,255,255,0.8) !important;
    margin: 20px 0 !important;
    padding: 24px 28px !important;
    color: #374151 !important;
    font-size: 1.05em !important;
    line-height: 1.8 !important;
    font-family: 'Nunito', 'Microsoft YaHei', 'PingFang SC', sans-serif !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.narrative-box:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.15), inset 0 0 10px rgba(255,255,255,0.9) !important;
}

/* 修复内部段落的间距 */
.narrative-box p {
    margin-bottom: 12px !important;
}
.narrative-box p:last-child {
    margin-bottom: 0 !important;
}

/* 让容器内的回车换行正常生效，防止文字挤成一团 */
.campus-theme-bg details {
    white-space: pre-wrap; 
    line-height: 1.6; /* 增加行距，阅读更舒适 */
}

/* 美化 <b> 标签（加粗字体） */
.campus-theme-bg b {
    font-weight: 600; /* 确保足够粗 */
    color: #2c3e50; /* 建议给加粗字体一个稍微深一点的颜色，或者改成你的主题色 */
}

/* 如果你的列表使用了减号 "-"，可以稍微调整一下缩进让排版更整齐 */
.campus-theme-bg details {
    padding-left: 10px;
}