/* ==========================================
   1. 自定义 HTML 排版部分（原样保留）
   ========================================== */
.dq-wrap {
  display: block;
  background: linear-gradient(135deg, #fdfbf7 0%, #f3e8d0 100%);
  border-radius: 12px;
  padding: 10px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #3e2723;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}
/* 海浪底部动态特效 */
.dq-wrap::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 50px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%2342eadd' fill-opacity='0.25' d='M0,160L48,170.7C96,181,192,203,288,197.3C384,192,480,160,576,160C672,160,768,192,864,213.3C960,235,1056,245,1152,229.3C1248,213,1344,171,1392,149.3L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") bottom/cover no-repeat;
  pointer-events: none;
  animation: dq-wave 15s linear infinite;
  z-index: 0;
}
@keyframes dq-wave { 0% { background-position-x: 0; } 100% { background-position-x: 1440px; } }
.dq-wrap > * { position: relative; z-index: 1; }
/* 顶部环境栏扫光特效 */
.dq-wrap .dq-hd {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(90deg, #0099cc, #42eadd);
  color: white;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  margin-bottom: 10px;
  box-shadow: 0 4px 10px rgba(66, 234, 221, 0.3);
  overflow: hidden;
}
.dq-wrap .dq-hd::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: dq-sweep 4s infinite;
}
@keyframes dq-sweep { 0% { left: -100%; } 50%, 100% { left: 200%; } }
/* 正文排版 */
.dq-wrap .dq-article {
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  line-height: 1.6;
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
}
.dq-wrap .dq-article p { margin: 0 0 8px 0; text-indent: 2em; }
.dq-wrap .dq-article p:last-child { margin-bottom: 0; }
/* 状态栏通用框架 */
.dq-wrap details {
  background: rgba(255,255,255,0.85);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e0d4b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.dq-wrap summary {
  background: linear-gradient(90deg, #e6ccb2, #ede0d4);
  padding: 8px 10px;
  font-weight: bold;
  font-size: 14px;
  color: #5c4033;
  cursor: pointer;
  list-style: none;
  border-radius: 8px;
  position: relative;
}
.dq-wrap details[open] summary { border-radius: 8px 8px 0 0; border-bottom: 1px solid #e0d4b8; }
.dq-wrap summary::-webkit-details-marker { display: none; }
.dq-wrap summary::after { content: '🌴'; position: absolute; right: 10px; transition: transform 0.3s; }
.dq-wrap details[open] summary::after { transform: rotate(90deg); }
/* 内部条目通用 */
.dq-wrap .ph, .dq-wrap .tr, .dq-wrap .np, .dq-wrap .lg, .dq-wrap .rc, .dq-wrap .ch { padding: 8px; font-size: 13px; }
.dq-wrap .dq-d { display: flex; flex-wrap: wrap; padding: 5px 6px; border-bottom: 1px dashed rgba(0,0,0,0.1); align-items: center; }
.dq-wrap .dq-d:last-child { border-bottom: none; }
.dq-wrap .dq-t { display: block; text-align: center; font-weight: bold; padding: 4px; margin: 6px 0; border-radius: 4px; font-size: 13px; }
.dq-wrap .dq-f { background: #d4a373; color: white; padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
/* 📱 幸存者手账 - 现代破损感 */
.dq-wrap .ph { background: linear-gradient(to bottom, #f0f4f8, #d9e2ec); }
.dq-wrap .ph .nt { display: flex; justify-content: space-between; background: #102a43; color: #bcccdc; padding: 3px 8px; border-radius: 6px 6px 0 0; font-size: 12px; font-family: monospace; }
.dq-wrap .ph .nt i { font-style: normal; }
.dq-wrap .ph .ps { background: #fff; border: 2px solid #102a43; border-top: none; border-radius: 0 0 6px 6px; padding: 6px; }
.dq-wrap .ph b { background: #334e68; color: white; padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
.dq-wrap .ph i { font-style: normal; color: #627d98; }
/* 🦴 娜娜 - 极致肉感色气与心跳特效 */
.dq-wrap details:nth-of-type(2) summary::before { content: '❤'; position: absolute; right: 35px; color: #ff4d6d; animation: dq-heartbeat 1.5s infinite; }
@keyframes dq-heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
.dq-wrap .tr { background: radial-gradient(circle at top right, #fff0f3, #ffc2d1); }
.dq-wrap .tr .dq-d { border-bottom-color: rgba(255, 143, 163, 0.3); }
.dq-wrap .tr .dq-t { background: linear-gradient(90deg, #ff8fa3, #ff4d6d); color: white; border-radius: 12px; box-shadow: 0 2px 5px rgba(255,77,109,0.3); }
/* 👥 NPC - 野性沙土 */
.dq-wrap .np { background: #fef6e4; }
.dq-wrap .np .dq-d { border-bottom-color: rgba(212, 163, 115, 0.3); }
/* 📋 日志 - 羊皮纸质感 */
.dq-wrap .lg { background: #faedcd; position: relative; }
.dq-wrap .lg::before { content: ''; position: absolute; top:0; left:0; right:0; bottom:0; background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23d4a373' fill-opacity='0.2'/%3E%3C/svg%3E"); pointer-events: none; }
.dq-wrap .lg .dq-t { background: #e9edc9; color: #5c4033; border: 1px dashed #d4a373; }
/* 📖 记录 - 紧凑表格 */
.dq-wrap .rc { background: #fefae0; }
.dq-wrap table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 12px; background: white; }
.dq-wrap th { background: #ccd5ae; color: #4a5d23; padding: 6px; text-align: center; border: 1px solid #e9edc9; }
.dq-wrap td { padding: 6px; border: 1px solid #e9edc9; text-align: center; }
.dq-wrap .rc details { box-shadow: none; border: 1px dashed #ccd5ae; margin-top: 6px; }
.dq-wrap .rc summary { background: #e9edc9; font-size: 13px; justify-content: center; }
/* 🎲 命运抉择 - 互动按钮 */
.dq-wrap .ch { background: #e0fbfc; display: grid; gap: 6px; }
.dq-wrap .ch .dq-d { border: none; padding: 8px 10px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.08); display: block; }
.dq-wrap .ch .dq-d:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.dq-wrap .ch .dq-d[c="沙"] { border-left: 5px solid #ff9f1c; color: #e36414; }
.dq-wrap .ch .dq-d[c="求"] { border-left: 5px solid #2ec4b6; color: #0077b6; }
.dq-wrap .ch .dq-d[c="白"] { border-left: 5px solid #ff5d8f; color: #c9184a; background: #fff0f3; }
.dq-wrap .ch .dq-d[c="正"] { border-left: 5px solid #8e9aaf; color: #463f3a; }
.dq-wrap .ch .dq-d[c="自"] { border-left: 5px solid #9d4edd; color: #5a189a; }
/* 海浪底部动态特效 */
dq::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 50px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%2342eadd' fill-opacity='0.25' d='M0,160L48,170.7C96,181,192,203,288,197.3C384,192,480,160,576,160C672,160,768,192,864,213.3C960,235,1056,245,1152,229.3C1248,213,1344,171,1392,149.3L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") bottom/cover no-repeat;
  pointer-events: none;
  animation: dq-wave 15s linear infinite;
  z-index: 0;
}
@keyframes dq-wave { 0% { background-position-x: 0; } 100% { background-position-x: 1440px; } }
dq > * { position: relative; z-index: 1; }
/* 顶部环境栏扫光特效 */
dq hd {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(90deg, #0099cc, #42eadd);
  color: white;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  margin-bottom: 10px;
  box-shadow: 0 4px 10px rgba(66, 234, 221, 0.3);
  overflow: hidden;
}
dq hd::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: dq-sweep 4s infinite;
}
@keyframes dq-sweep { 0% { left: -100%; } 50%, 100% { left: 200%; } }
/* 正文排版 */
dq article {
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  line-height: 1.6;
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
}
dq article p { margin: 0 0 8px 0; text-indent: 2em; }
dq article p:last-child { margin-bottom: 0; }
/* 状态栏通用框架 */
dq details {
  background: rgba(255,255,255,0.85);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e0d4b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
dq summary {
  background: linear-gradient(90deg, #e6ccb2, #ede0d4);
  padding: 8px 10px;
  font-weight: bold;
  font-size: 14px;
  color: #5c4033;
  cursor: pointer;
  list-style: none;
  border-radius: 8px;
  position: relative;
}
dq details[open] summary { border-radius: 8px 8px 0 0; border-bottom: 1px solid #e0d4b8; }
dq summary::-webkit-details-marker { display: none; }
dq summary::after { content: '🌴'; position: absolute; right: 10px; transition: transform 0.3s; }
dq details[open] summary::after { transform: rotate(90deg); }
/* 内部条目通用 */
dq details > div { padding: 8px; font-size: 13px; }
dq d { display: flex; flex-wrap: wrap; padding: 5px 6px; border-bottom: 1px dashed rgba(0,0,0,0.1); align-items: center; }
dq d:last-child { border-bottom: none; }
dq t { display: block; text-align: center; font-weight: bold; padding: 4px; margin: 6px 0; border-radius: 4px; font-size: 13px; }
dq f { background: #d4a373; color: white; padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
/* 📱 幸存者手账 - 现代破损感 */
dq details:nth-of-type(1) > div { background: linear-gradient(to bottom, #f0f4f8, #d9e2ec); }
dq details:nth-of-type(1) > div > div:first-child { display: flex; justify-content: space-between; background: #102a43; color: #bcccdc; padding: 3px 8px; border-radius: 6px 6px 0 0; font-size: 12px; font-family: monospace; }
dq details:nth-of-type(1) > div > div:first-child i { font-style: normal; }
dq details:nth-of-type(1) > div > div:last-child { background: #fff; border: 2px solid #102a43; border-top: none; border-radius: 0 0 6px 6px; padding: 6px; }
dq details:nth-of-type(1) b { background: #334e68; color: white; padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
dq details:nth-of-type(1) i { font-style: normal; color: #627d98; }
/* 🦴 娜娜 - 极致肉感色气与心跳特效 */
dq details:nth-of-type(2) summary::before { content: '❤'; position: absolute; right: 35px; color: #ff4d6d; animation: dq-heartbeat 1.5s infinite; }
@keyframes dq-heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
dq details:nth-of-type(2) > div { background: radial-gradient(circle at top right, #fff0f3, #ffc2d1); }
dq details:nth-of-type(2) d { border-bottom-color: rgba(255, 143, 163, 0.3); }
dq details:nth-of-type(2) t { background: linear-gradient(90deg, #ff8fa3, #ff4d6d); color: white; border-radius: 12px; box-shadow: 0 2px 5px rgba(255,77,109,0.3); }
/* 👥 NPC - 野性沙土 */
dq details:nth-of-type(3) > div { background: #fef6e4; }
dq details:nth-of-type(3) d { border-bottom-color: rgba(212, 163, 115, 0.3); }
/* 📋 日志 - 羊皮纸质感 */
dq details:nth-of-type(4) > div { background: #faedcd; position: relative; }
dq details:nth-of-type(4) > div::before { content: ''; position: absolute; top:0; left:0; right:0; bottom:0; background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23d4a373' fill-opacity='0.2'/%3E%3C/svg%3E"); pointer-events: none; }
dq details:nth-of-type(4) t { background: #e9edc9; color: #5c4033; border: 1px dashed #d4a373; }
/* 📖 记录 - 紧凑表格 */
dq details:nth-of-type(5) > div { background: #fefae0; }
dq table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 12px; background: white; }
dq th { background: #ccd5ae; color: #4a5d23; padding: 6px; text-align: center; border: 1px solid #e9edc9; }
dq td { padding: 6px; border: 1px solid #e9edc9; text-align: center; }
dq details:nth-of-type(5) details { box-shadow: none; border: 1px dashed #ccd5ae; margin-top: 6px; }
dq details:nth-of-type(5) details summary { background: #e9edc9; font-size: 13px; justify-content: center; }
/* 🎲 命运抉择 - 互动按钮 */
dq details:nth-of-type(6) > div { background: #e0fbfc; display: grid; gap: 6px; }
dq details:nth-of-type(6) d { border: none; padding: 8px 10px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.08); display: block; }
dq details:nth-of-type(6) d:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
dq details:nth-of-type(6) d:nth-of-type(1) { border-left: 5px solid #ff9f1c; color: #e36414; }
dq details:nth-of-type(6) d:nth-of-type(2) { border-left: 5px solid #2ec4b6; color: #0077b6; }
dq details:nth-of-type(6) d:nth-of-type(3) { border-left: 5px solid #ff5d8f; color: #c9184a; background: #fff0f3; }
dq details:nth-of-type(6) d:nth-of-type(4) { border-left: 5px solid #8e9aaf; color: #463f3a; }
dq details:nth-of-type(6) d:nth-of-type(5) { border-left: 5px solid #9d4edd; color: #5a189a; }


/* ==========================================
   2. Rili 平台 UI 覆盖部分 (已转换选择器)
   ========================================== */

/* 1. 聊天框主体：清新绿渐变与新奇的叶片形态圆角 */
.is-user > div:first-child,
.is-assistant > div:first-child {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    /* 新奇美术：不对称的圆角，模拟叶片的形态 */
    border-radius: 24px 24px 24px 6px !important;
    box-shadow: 
        0 4px 15px rgba(165, 214, 167, 0.4),
        inset 0 2px 5px rgba(255, 255, 255, 0.8) !important;
    padding: 16px 20px !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    isolation: isolate !important; /* 建立层叠上下文 */
    overflow: hidden !important;
    position: relative !important;
}

/* 增加一层微妙的几何网格纹理，提升美术质感 */
.is-user > div:first-child::after,
.is-assistant > div:first-child::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-image: radial-gradient(rgba(255,255,255,0.4) 1px, transparent 1px) !important;
    background-size: 10px 10px !important;
    opacity: 0.5 !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

/* 2. 核心文本：绝对可读性优先（浅绿背景配深墨绿文字） */
.rili-markdown-renderer {
    color: #1a3b2b !important; /* 高对比度深墨绿 */
    font-weight: 500 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
    background: transparent !important;
    z-index: 1 !important;
    text-shadow: none !important; /* 严禁文字阴影以保可读性 */
}

/* 3. 底部附加元素（工具栏按钮、模型消耗等）：柔和的深绿色 */
.is-user .text-muted-foreground,
.is-assistant .text-muted-foreground,
.is-user button,
.is-assistant button,
.is-user button svg,
.is-assistant button svg {
    color: #2e6041 !important; 
    stroke: #2e6041 !important;
    font-weight: 600 !important;
    opacity: 0.85 !important;
}

/* 4. 悬浮交互反馈 */
.is-user > div:first-child:hover,
.is-assistant > div:first-child:hover {
    box-shadow: 
        0 6px 20px rgba(129, 199, 132, 0.5),
        inset 0 2px 5px rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px) !important;
}

/* ==========================================
   5. 加载动画：SMIL SVG 绿色生命跳动圆点
   ========================================== */

/* 隐藏平台默认的闪烁加载点 */
.flex.gap-2.w-full.h-full.items-center.justify-center span {
    display: none !important;
}

/* 配置加载动画的父容器 */
.flex.gap-2.w-full.h-full.items-center.justify-center {
    position: relative !important;
    width: 40px !important; 
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 注入基于 SVG SMIL 的动效（不受系统 CSS 动画禁用影响） */
.flex.gap-2.w-full.h-full.items-center.justify-center::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='32' height='32'%3E%3Ccircle cx='4' cy='12' r='3' fill='%234ade80'%3E%3Canimate attributeName='cy' values='12;6;12' dur='0.6s' repeatCount='indefinite' begin='0s'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='3' fill='%2322c55e'%3E%3Canimate attributeName='cy' values='12;6;12' dur='0.6s' repeatCount='indefinite' begin='0.2s'/%3E%3C/circle%3E%3Ccircle cx='20' cy='12' r='3' fill='%2316a34a'%3E%3Canimate attributeName='cy' values='12;6;12' dur='0.6s' repeatCount='indefinite' begin='0.4s'/%3E%3C/circle%3E%3C/svg%3E") !important;
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}