/* === 菲布里斯·魔法主题UI · Rilichat适配完整版 v2 (就近Pop) === */

:root{
  --fb-bg:rgba(15,10,25,0.95);
  --fb-bd:rgba(255,215,0,0.4);
  --fb-c1:#e0e0e0;
  --fb-c2:#ffd700;
  --fb-cw:#fff;
  --fb-r:12px;
}

/* --- 全局字色 --- */
.rili-markdown-renderer{color:var(--fb-c1)!important;width:100%!important;max-width:100%!important}
.rili-markdown-renderer>*{max-width:100%!important}
.rili-markdown-renderer p{font-size:16px!important;line-height:1.7!important}

/* --- 气泡容器 --- */
.is-user > div,
.is-assistant > div{
  background-color:var(--fb-bg)!important;
  background-image:url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4"%3E%3Cpath fill="%239932cc" fill-opacity="0.08" d="M1 3h1v1H1V3zm2-2h1v1H3V1z"%3E%3C/path%3E%3C/svg%3E')!important;
  border:1px solid var(--fb-bd)!important;
  box-shadow:0 8px 25px rgba(0,0,0,.4)!important;
  border-radius:var(--fb-r)!important;
  width:100%!important;max-width:100%!important;
  display:block!important;
}

/* --- 气泡底部按钮 --- */
.is-assistant > div button,
.is-user > div button{
  background:rgba(75,0,130,0.5)!important;
  color:#ffd700!important;
  border:1px solid rgba(255,215,0,0.4)!important;
  border-radius:6px!important;
  box-shadow:1px 1px 0 rgba(255,215,0,0.3)!important;
  font-weight:600!important;
  font-size:12px!important;
  text-transform:none!important;
  transition:all .1s!important;
  padding:3px 10px!important;
  min-width:auto!important;
  line-height:1.5!important;
}
.is-assistant > div button:hover,
.is-user > div button:hover{
  background:rgba(153,50,204,0.6)!important;
  transform:translate(1px,1px)!important;
  box-shadow:0 0 0 rgba(255,215,0,0.3)!important;
}
.is-assistant > div button svg,
.is-user > div button svg{stroke:#ffd700!important}

/* --- 输入框外圈 --- */
form#prompt-input{background-color:transparent!important;box-shadow:none!important}
div[data-slot="input-group"]{
  background-color:var(--fb-bg)!important;
  border:1px solid var(--fb-bd)!important;
  border-radius:var(--fb-r)!important;
  box-shadow:0 4px 20px rgba(0,0,0,.7)!important;
  transition:all .3s ease!important;
}
div[data-slot="input-group"]:focus-within{
  border-color:#ffd700!important;
  box-shadow:0 0 12px rgba(255,215,0,0.4),0 4px 20px rgba(0,0,0,.8)!important;
}

/* --- 输入框本体 --- */
#prompt-input textarea{
  background-color:transparent!important;
  border:none!important;
  box-shadow:none!important;
  color:var(--fb-c1)!important;
  padding:12px 16px!important;
  font-size:16px!important;
  line-height:1.6!important;
}
#prompt-input textarea:focus{border:none!important;box-shadow:none!important;outline:none!important}
#prompt-input textarea::placeholder{color:rgba(224,224,224,0.4)!important}

/* --- 输入框上下方功能按钮 --- */
#prompt-input-header button,
#prompt-input-footer button{
  background:rgba(75,0,130,0.5)!important;
  color:#ffd700!important;
  border:1px solid rgba(255,215,0,0.4)!important;
  border-radius:8px!important;
  box-shadow:2px 2px 0 rgba(255,215,0,0.3)!important;
  font-weight:600!important;
  text-transform:none!important;
  transition:all .1s!important;
  padding:6px 14px!important;
}
#prompt-input-header button:hover,
#prompt-input-footer button:hover{
  background:rgba(153,50,204,0.6)!important;
  transform:translate(2px,2px)!important;
  box-shadow:0 0 0 rgba(255,215,0,0.3)!important;
}
#prompt-input-header button svg,
#prompt-input-footer button svg{stroke:#ffd700!important}
#prompt-input-header button:hover svg,
#prompt-input-footer button:hover svg{stroke:#fff!important}

#prompt-input-footer .truncate{color:#ffd700!important}
#prompt-input-footer button:hover .truncate{color:#fff!important}
#prompt-input-footer button img{filter:hue-rotate(260deg) saturate(1.5) brightness(0.95)!important}

/* --- 发送按钮 --- */
#prompt-input-footer button[type="submit"]{
  background:linear-gradient(145deg,#ffd700,#b8860b)!important;
  color:#2a0a3a!important;
  border:1px solid rgba(75,0,130,0.8)!important;
  box-shadow:2px 2px 5px rgba(0,0,0,.6)!important;
  border-radius:8px!important;
}
#prompt-input-footer button[type="submit"]:hover{
  background:linear-gradient(145deg,#ffe44d,#d4a017)!important;
  transform:translate(1px,1px)!important;
  box-shadow:0 0 8px rgba(255,215,0,0.5)!important;
}
#prompt-input-footer button[type="submit"] svg{stroke:#2a0a3a!important}

/* --- 加载动画 GIF --- */
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2){
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  width:100%!important;
  height:auto!important;
  padding:1em 0!important;
}
.flex.items-center.justify-center.size-6 > .flex.gap-2::before,
.flex.items-center.justify-center.size-6 > .flex.gap-2::after{
  content:none!important;display:none!important;
}
.flex.items-center.justify-center.size-6 > .flex.gap-2{
  display:block!important;
  position:relative!important;
  width:clamp(160px,40vw,320px)!important;
  height:auto!important;
  aspect-ratio:16/9!important;
  background-image:url('https://pic1.imgdb.cn/item/6969192d3fd74b78f8ae1216.gif')!important;
  background-size:contain!important;
  background-position:center!important;
  background-repeat:no-repeat!important;
  background-color:transparent!important;
  border-radius:18px!important;
  box-shadow:
    0 0 1em rgba(153,50,204,0.5),
    0 0 2em rgba(255,215,0,0.25),
    inset 0 0 0.5em rgba(20,12,35,0.4)!important;
  border:1px solid rgba(255,215,0,0.4)!important;
  clip-path:none!important;
  animation:none!important;
  margin:0!important;
  flex-shrink:0!important;
}
.flex.items-center.justify-center.size-6{opacity:1!important}
.is-assistant.w-fit{width:100%!important}
.is-assistant > .border.border-muted:has(.flex.items-center.justify-center.size-6){
  width:100%!important;
  background:transparent!important;
  border:none!important;
  padding:0!important;
}
.is-assistant .space-y-3:has(.flex.items-center.justify-center.size-6){
  display:flex;justify-content:center;width:100%;
}

/* ═══════════════════════════════════════════
   .ctn 内部样式
   ═══════════════════════════════════════════ */

.ctn{font-family:"Microsoft YaHei",sans-serif;font-size:14px;line-height:1.6;color:#e0e0e0;width:100%!important;max-width:100%!important;min-width:0!important;display:block!important;box-sizing:border-box!important;padding:8px}
.ctn *{box-sizing:border-box}

/* === Tip + Pop 就近弹出版 === */
.ctn .tip{
  display:inline-block;
  position:relative!important;
  z-index:1;
  color:#ffd700;
  border-bottom:1px dotted rgba(255,215,0,.5);
  cursor:help;
  font-weight:600;
  margin:0 2px;
}
.ctn .tip:hover{color:#ffe44d;background:rgba(255,215,0,.1)}

.ctn .pop{
  display:none;
  position:absolute!important;
  top:calc(100% + 8px)!important;
  left:50%!important;
  transform:translateX(-50%)!important;
  width:280px!important;
  max-width:90vw!important;
  max-height:60vh!important;
  z-index:2147483647!important;
  background:linear-gradient(160deg,rgba(20,12,35,0.98),rgba(30,18,50,0.95))!important;
  border:2px solid rgba(153,50,204,0.6)!important;
  border-top:4px solid rgba(153,50,204,0.8)!important;
  box-shadow:0 15px 50px rgba(0,0,0,.6)!important;
  color:#e0e0e0!important;
  padding:14px!important;
  border-radius:8px!important;
  font-size:13px!important;
  line-height:1.6!important;
  overflow-y:auto!important;
  pointer-events:none;
  animation:popIn .2s ease;
}
.ctn .tip:hover .pop{display:block!important;pointer-events:auto}
.ctn .pop::before{
  content:'';
  position:absolute;
  top:-8px;
  left:50%;
  transform:translateX(-50%);
  border:6px solid transparent;
  border-bottom-color:rgba(153,50,204,0.8);
}
.ctn .pop b{display:block;font-size:14px;color:#ffd700;margin-bottom:10px;padding-bottom:8px;border-bottom:1px solid rgba(255,215,0,.3)}
.ctn .pop em{color:#ffd700;font-style:normal;font-weight:600}

@keyframes popIn{
  from{opacity:0;transform:translateX(-50%) translateY(-4px)}
  to{opacity:1;transform:translateX(-50%) translateY(0)}
}

/* 防裁剪：让所有上游容器允许溢出 */
.is-user > div,
.is-assistant > div,
.rili-markdown-renderer,
.rili-markdown-renderer > *,
.ctn,
.ctn .section,
.ctn .section-content,
.ctn .subsection,
.ctn details,
.ctn .npc-card,
.ctn .monster-card,
.ctn .inv,
.ctn .equip-grid,
.ctn .list,
.ctn .list li,
.ctn .eq,
.ctn .inv > div{
  overflow:visible!important;
}

/* === Section 折叠容器 === */
.ctn .section{margin:12px 0;border:2px solid #ffd700;border-radius:12px;background:rgba(20,12,35,0.9);position:relative;box-shadow:0 0 15px rgba(255,215,0,0.25),0 0 30px rgba(153,50,204,0.15),inset 0 1px 0 rgba(255,215,0,0.1);animation:sectionPulse 4s ease-in-out infinite;transition:all 0.3s ease;width:100%!important;max-width:100%!important;min-width:0!important;display:block!important}
.ctn .section::before{content:'';position:absolute;top:-4px;left:-4px;right:-4px;bottom:-4px;border:1px solid rgba(153,50,204,0.5);border-radius:14px;pointer-events:none;animation:borderGlow 3s ease-in-out infinite alternate;z-index:-1}
.ctn .section::after{content:'';position:absolute;top:0;left:20px;right:20px;height:1px;background:linear-gradient(90deg,transparent,rgba(255,215,0,0.6),transparent);animation:shimmer 2s ease-in-out infinite;z-index:1;pointer-events:none}
.ctn .section:hover{box-shadow:0 0 25px rgba(255,215,0,0.4),0 0 50px rgba(153,50,204,0.25),inset 0 1px 0 rgba(255,215,0,0.2);border-color:#ffe44d}
@keyframes sectionPulse{0%,100%{box-shadow:0 0 15px rgba(255,215,0,0.25),0 0 30px rgba(153,50,204,0.15),inset 0 1px 0 rgba(255,215,0,0.1)}50%{box-shadow:0 0 20px rgba(255,215,0,0.35),0 0 40px rgba(153,50,204,0.2),inset 0 1px 0 rgba(255,215,0,0.15)}}
@keyframes borderGlow{0%{border-color:rgba(153,50,204,0.3);box-shadow:0 0 5px rgba(153,50,204,0.1)}100%{border-color:rgba(153,50,204,0.6);box-shadow:0 0 10px rgba(153,50,204,0.2)}}
@keyframes shimmer{0%,100%{opacity:0.3;transform:scaleX(0.5)}50%{opacity:1;transform:scaleX(1)}}

.ctn .section>summary{display:flex;align-items:center;padding:14px 20px;cursor:pointer;background:linear-gradient(135deg,rgba(153,50,204,0.85) 0%,rgba(100,30,150,0.9) 50%,rgba(75,0,130,0.85) 100%);color:#fff;font-weight:600;font-size:1.1em;list-style:none;border-bottom:1px solid rgba(255,215,0,0.4);text-shadow:0 0 10px rgba(255,215,0,0.3);position:relative;overflow:hidden;transition:all 0.3s ease;border-radius:10px 10px 0 0;width:100%!important;min-width:0!important;box-sizing:border-box!important}
.ctn .section:not([open])>summary{border-bottom:none;border-radius:10px}
.ctn .section>summary::after{content:'';position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,215,0,0.1),transparent);transition:left 0.5s ease}
.ctn .section>summary:hover{background:linear-gradient(135deg,rgba(120,40,180,0.9) 0%,rgba(80,20,130,0.95) 50%,rgba(60,0,100,0.9) 100%);text-shadow:0 0 15px rgba(255,215,0,0.5)}
.ctn .section>summary:hover::after{left:100%}
.ctn .section>summary::-webkit-details-marker{display:none}
.ctn .section>summary::before{content:'✦';margin-right:12px;font-size:1.1em;color:#ffd700;text-shadow:0 0 8px rgba(255,215,0,0.6);transition:all .3s;animation:starTwinkle 2s ease-in-out infinite}
.ctn .section[open]>summary::before{transform:rotate(72deg) scale(1.2);text-shadow:0 0 12px rgba(255,215,0,0.8)}
@keyframes starTwinkle{0%,100%{opacity:0.8;text-shadow:0 0 8px rgba(255,215,0,0.6)}50%{opacity:1;text-shadow:0 0 12px rgba(255,215,0,0.9)}}

.ctn .time-section>summary{line-height:1.5;flex-direction:column;align-items:flex-start}
.ctn .section-content{padding:12px 16px;background:rgba(25,15,40,0.85);border-top:none;position:relative;border-radius:0 0 10px 10px;width:100%!important;min-width:0!important;box-sizing:border-box!important}
.ctn .section-content::before{content:'';position:absolute;top:0;left:10%;right:10%;height:1px;background:linear-gradient(90deg,transparent,rgba(153,50,204,0.4),transparent)}

.ctn .subsection{margin-bottom:14px;padding-bottom:12px;border-bottom:1px dashed rgba(255,215,0,0.2)}
.ctn .subsection:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}
.ctn .sub-title{font-weight:600;color:#ffd700;margin-bottom:8px;font-size:13px;letter-spacing:1px}

.ctn .info-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;width:100%!important}
.ctn .info-grid>span{padding:6px 10px;border:1px solid rgba(255,215,0,0.2);border-radius:6px;background:rgba(20,12,35,0.85);word-break:break-word}
.ctn .info-grid>span:nth-child(odd){background:rgba(30,18,50,0.8)}
.ctn .info-grid .lb{color:#ffd700;font-size:13px;font-weight:600}
.ctn .info-row{margin:8px 0;font-size:13px;padding:8px 10px;background:rgba(20,12,35,0.85);border:1px solid rgba(255,215,0,0.2);border-radius:6px;word-break:break-word}
.ctn .info-row .lb{color:#ffd700;font-weight:600}

.ctn .exp-row{display:flex;align-items:center;gap:10px;margin-top:10px;flex-wrap:wrap}
.ctn .exp-num{color:#ffd700;font-weight:600;font-size:13px}
.ctn .bar{flex:1;min-width:100px;height:12px;background:rgba(0,0,0,.3);border-radius:6px;border:1px solid rgba(255,215,0,0.3);overflow:hidden}
.ctn .bar .fill{height:100%;border-radius:5px}
.ctn .bar.exp .fill{background:linear-gradient(90deg,#ffd700,#ffaa00)}
.ctn .bar.hp .fill{background:linear-gradient(90deg,#ff6b6b,#d32f2f)}
.ctn .bar.mp .fill{background:linear-gradient(90deg,#64b5f6,#1976d2)}

.ctn .list{list-style:none;padding:0;margin:0;width:100%!important}
.ctn .list li{padding:8px 12px;margin-bottom:5px;background:rgba(20,12,35,0.85);border-radius:6px;border-left:3px solid rgba(153,50,204,0.6);font-size:13px;word-break:break-word}
.ctn .list.npc-sk li{border-left-color:rgba(255,99,71,0.8)}
.ctn .list.monster-sk li{border-left-color:rgba(153,50,204,0.6)}
.ctn .list.rel-net li{border-left-color:rgba(70,130,180,0.8)}

.ctn .equip-grid{display:grid;gap:5px;width:100%!important}
.ctn .eq{padding:7px 12px;background:rgba(20,12,35,0.85);border-radius:6px;font-size:13px;border:1px solid rgba(255,215,0,0.2);word-break:break-word}
.ctn .slot{color:#ffd700;font-weight:600;margin-right:4px}

.ctn .stat-bars{margin-bottom:10px;width:100%!important}
.ctn .st-row{display:flex;align-items:center;gap:8px;margin-bottom:6px;flex-wrap:wrap;width:100%!important}
.ctn .st-lb{width:26px;font-weight:600;font-size:12px;color:#ffd700;flex-shrink:0}
.ctn .st-val{min-width:70px;font-size:12px;color:#ffd700;text-align:right}

.ctn .attr-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:10px;width:100%!important}
.ctn .attr{background:rgba(20,12,35,0.85);border-radius:8px;padding:8px 4px;text-align:center;border:1px solid rgba(255,215,0,0.2);font-size:16px}
.ctn .attr span{display:block;font-size:11px;color:#ffd700}
.ctn .attr b{display:block;font-size:15px;color:#ffd700}
.ctn .ext-attr{background:rgba(30,18,50,0.8);border-radius:6px;padding:10px;font-size:12px;color:#e0e0e0;width:100%!important}
.ctn .ext-attr div{display:flex;flex-wrap:wrap;gap:4px 8px;justify-content:center}
.ctn .ext-attr b{color:#ffd700;font-weight:600;margin-left:2px}

.ctn .inv{display:grid;gap:6px;width:100%!important}
.ctn .inv>div{padding:8px 12px;background:rgba(20,12,35,0.85);border-radius:6px;border:1px solid rgba(255,215,0,0.2);word-break:break-word}

.ctn .quest{padding:10px;border-radius:6px;margin-bottom:6px;font-size:13px;word-break:break-word;width:100%!important}
.ctn .quest.main{background:rgba(255,215,0,.15);border:1px solid rgba(255,215,0,.4)}
.ctn .quest.side{background:rgba(153,50,204,.15);border:1px solid rgba(153,50,204,.4)}
.ctn .qtag{font-weight:700;font-size:12px;padding:2px 8px;border-radius:10px;margin-right:8px;display:inline-block}
.ctn .quest.main .qtag{color:#ffd700;background:rgba(255,215,0,.2)}
.ctn .quest.side .qtag{color:#da70d6;background:rgba(153,50,204,.2)}

.ctn .npc-card,.ctn .monster-card{background:rgba(20,12,35,0.85);border-radius:8px;padding:12px;margin-bottom:10px;border:1px solid rgba(255,215,0,0.2);width:100%!important}
.ctn .npc-hd{font-weight:600;color:rgba(255,99,71,0.9);margin-bottom:10px;padding-bottom:6px;border-bottom:1px solid rgba(255,215,0,0.2)}
.ctn .npc-card.sub .npc-hd{color:rgba(150,150,200,0.9)}
.ctn .thought{background:rgba(255,215,0,.1);padding:8px;border-radius:6px;border-left:3px solid #ffd700;margin:10px 0;word-break:break-word}
.ctn .thought i{color:#ffd700;font-style:italic}
.ctn .npc-attr{background:rgba(30,18,50,0.8);border-radius:6px;padding:10px;margin:10px 0;font-size:13px;width:100%!important}
.ctn .npc-attr>div{display:flex;flex-wrap:wrap;gap:4px 8px;justify-content:center;margin-bottom:8px}
.ctn .npc-attr .small{font-size:11px;color:#ffd700}
.ctn .npc-attr b{color:#e0e0e0;font-weight:600;margin-left:2px}
.ctn .npc-div{text-align:center;color:rgba(255,215,0,0.3);margin:10px 0}

.ctn .body-st{display:grid;gap:6px;width:100%!important}
.ctn .body-st>div{font-size:13px;padding:6px 8px;background:rgba(30,18,50,0.8);border-radius:4px;word-break:break-word}
.ctn .bp{color:rgba(255,100,150,0.9);font-weight:600}

.ctn .mem-sub{margin-bottom:8px;background:rgba(20,12,35,0.85);border-radius:6px;border:1px solid rgba(255,215,0,0.2);overflow:hidden;width:100%!important}
.ctn .mem-sub>summary{padding:10px 14px;font-weight:600;font-size:14px;cursor:pointer;list-style:none;color:#ffd700;background:rgba(30,18,50,0.8);width:100%!important}
.ctn .mem-sub>summary::-webkit-details-marker{display:none}
.ctn .mem-sub>summary::before{content:'▸';margin-right:8px;transition:transform .2s}
.ctn .mem-sub[open]>summary::before{transform:rotate(90deg)}
.ctn .mem-ct{padding:10px;background:rgba(20,12,35,0.85);overflow-x:auto;width:100%!important}
.ctn .mem-tb{width:100%;border-collapse:separate;border-spacing:0;font-size:12px;border-radius:6px;overflow:hidden;min-width:400px}
.ctn .mem-tb th,.ctn .mem-tb td{padding:6px 8px;text-align:left;border:1px solid rgba(255,215,0,0.2)}
.ctn .mem-tb th{background:rgba(25,15,40,0.9);color:#ffd700;font-weight:600;white-space:nowrap}
.ctn .mem-tb td{background:rgba(30,18,50,0.8)}
.ctn .mem-tb tbody tr:nth-child(even) td{background:rgba(35,20,55,0.8)}

.ctn .choice-sec{padding:14px;background:rgba(20,12,35,0.9);border:2px solid #ffd700;margin:12px 0;border-radius:12px;position:relative;box-shadow:0 0 15px rgba(255,215,0,0.25),0 0 30px rgba(153,50,204,0.15);width:100%!important;max-width:100%!important;min-width:0!important;display:block!important;box-sizing:border-box!important}
.ctn .ch-hd{font-size:15px;font-weight:600;color:#ffd700;margin-bottom:10px;text-align:center}
.ctn .ch-hint{background:rgba(255,215,0,.1);border-radius:6px;padding:8px;margin-bottom:12px;font-size:13px;border:1px solid rgba(255,215,0,.2);word-break:break-word;width:100%!important}
.ctn .ch-hint b{color:#ffd700}
.ctn .ch-list{list-style:none;padding:0;margin:0;counter-reset:ch;width:100%!important}
.ctn .ch-list li{counter-increment:ch;padding:10px 14px;margin-bottom:6px;background:rgba(25,15,40,0.8);border-radius:8px;cursor:pointer;transition:all .2s;border:1px solid rgba(255,215,0,0.3);word-break:break-word;width:100%!important;display:block!important;box-sizing:border-box!important}
.ctn .ch-list li::before{content:counter(ch,upper-alpha)".";font-weight:700;color:#ffd700;margin-right:10px}
.ctn .ch-list li:hover{background:rgba(75,0,130,0.5);box-shadow:0 4px 12px rgba(0,0,0,.3)}
.ctn .ch-list li:last-child{margin-bottom:0}

.ctn ::-webkit-scrollbar{width:6px;height:6px}
.ctn ::-webkit-scrollbar-track{background:rgba(15,10,25,0.95);border-radius:3px}
.ctn ::-webkit-scrollbar-thumb{background:rgba(153,50,204,0.5);border-radius:3px}
.ctn ::-webkit-scrollbar-thumb:hover{background:rgba(153,50,204,0.7)}

.ctn details{width:100%!important;display:block!important;box-sizing:border-box!important}
.ctn details[open]{width:100%!important}

.ctn .monster-section > summary{
  background:linear-gradient(135deg,rgba(153,50,204,0.85) 0%,rgba(100,30,150,0.9) 50%,rgba(75,0,130,0.85) 100%);
  border-bottom:1px solid rgba(255,215,0,0.4);
  text-shadow:0 0 10px rgba(255,215,0,0.3);
}
.ctn .monster-section > summary:hover{
  background:linear-gradient(135deg,rgba(120,40,180,0.9) 0%,rgba(80,20,130,0.95) 50%,rgba(60,0,100,0.9) 100%);
  text-shadow:0 0 15px rgba(255,215,0,0.5);
}
.ctn .monster-section > summary::before{
  content:'✦';color:#ffd700;text-shadow:0 0 8px rgba(255,215,0,0.6);
}
.ctn .monster-section[open]>summary::before{transform:rotate(72deg) scale(1.2);text-shadow:0 0 12px rgba(255,215,0,0.8)}

/* === 响应式 === */
@media(max-width:768px){
.ctn{padding:4px;width:100%!important;max-width:100%!important;min-width:0!important;display:block!important}
.ctn>*{width:100%!important;max-width:100%!important;min-width:0!important}
.ctn .section{margin:8px 0;border-radius:8px;width:100%!important;max-width:100%!important;min-width:0!important;flex-shrink:0!important;flex-grow:1!important}
.ctn .section::before{top:-2px;left:-2px;right:-2px;bottom:-2px;border-radius:10px}
.ctn .section>summary{padding:10px 12px;font-size:1em;border-radius:6px 6px 0 0;flex-wrap:wrap!important;white-space:normal!important;width:100%!important}
.ctn .section:not([open])>summary{border-radius:6px}
.ctn .section-content{padding:10px;border-radius:0 0 6px 6px;width:100%!important}
.ctn .player-section,.ctn .npc-section,.ctn .memory-section,.ctn .monster-section{width:100%!important;max-width:100%!important;min-width:0!important;flex-shrink:0!important;flex-grow:1!important}
.ctn details,.ctn .section-content{width:100%!important;max-width:100%!important;min-width:0!important;flex-shrink:0!important;flex-grow:1!important}
.ctn .choice-sec{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;flex-shrink:0!important;flex-grow:1!important;padding:10px;margin:8px 0;border-radius:8px}
.ctn .ch-list{width:100%!important}
.ctn .ch-list li{width:100%!important;display:block!important;padding:8px 12px}
.ctn .attr-grid{grid-template-columns:repeat(2,1fr)}
.ctn .attr{padding:6px 2px}
.ctn .attr span{font-size:10px}
.ctn .attr b{font-size:14px}
.ctn .ext-attr{padding:8px}
.ctn .ext-attr div{font-size:10px;gap:3px 6px}
.ctn .npc-attr>div{font-size:11px}
.ctn .npc-attr .small{font-size:10px}
.ctn .pop{width:240px!important;max-width:80vw!important;font-size:12px!important;padding:10px!important}
.ctn .info-grid{grid-template-columns:1fr;width:100%!important}
.ctn .info-grid>span{padding:5px 8px}
.ctn .st-row{gap:6px;width:100%!important}
.ctn .st-lb{width:24px;font-size:11px}
.ctn .st-val{min-width:60px;font-size:11px}
.ctn .bar{min-width:80px;height:10px}
.ctn .mem-ct{padding:8px;width:100%!important}
.ctn .sub-title{font-size:12px}
.ctn .list li,.ctn .eq,.ctn .inv>div{padding:6px 10px;font-size:12px}
.ctn .subsection{width:100%!important}
.ctn .equip-grid{width:100%!important}
.ctn .stat-bars{width:100%!important}
.ctn .inv{width:100%!important}
.ctn .quest{width:100%!important}
.ctn .npc-card,.ctn .monster-card{width:100%!important}
.ctn .npc-attr{width:100%!important}
.ctn .body-st{width:100%!important}
.ctn .mem-sub{width:100%!important}
.ctn .ch-hint{width:100%!important}
}

@media(max-width:400px){
.ctn{padding:2px;width:100%!important;max-width:100%!important}
.ctn>*{width:100%!important;max-width:100%!important}
.ctn .section{margin:6px 0;border-width:1px;width:100%!important}
.ctn .section::before{display:none}
.ctn .section::after{left:10px;right:10px}
.ctn .section>summary{padding:8px 10px;font-size:0.95em;width:100%!important}
.ctn .section>summary::before{margin-right:8px;font-size:1em}
.ctn .section-content{padding:8px;width:100%!important}
.ctn .attr-grid{gap:4px}
.ctn .attr{padding:5px 2px}
.ctn .ext-attr div{font-size:9px;gap:2px 4px}
.ctn .choice-sec{padding:8px;border-width:1px;width:100%!important}
.ctn .ch-hd{font-size:14px}
.ctn .ch-list li{padding:6px 10px;font-size:12px;width:100%!important}
.ctn .sub-title{font-size:11px;margin-bottom:6px}
.ctn .info-row{padding:6px 8px;font-size:12px}
.ctn .quest{padding:8px;font-size:12px}
.ctn .npc-card,.ctn .monster-card{padding:10px}
.ctn .thought{padding:6px}
.ctn .body-st>div{padding:5px 6px;font-size:12px}
.ctn .mem-sub>summary{padding:8px 10px;font-size:13px;width:100%!important}
.ctn .mem-tb{min-width:300px;font-size:11px}
.ctn .mem-tb th,.ctn .mem-tb td{padding:4px 6px}
.ctn .player-section,.ctn .npc-section,.ctn .memory-section,.ctn .monster-section,.ctn .choice-sec{width:100%!important;max-width:100%!important;min-width:0!important;display:block!important}
}

/* === 防容器干扰强制修复 === */
.ctn,.ctn *{box-sizing:border-box!important}
.ctn .section,.ctn .player-section,.ctn .npc-section,.ctn .memory-section,.ctn .time-section,.ctn .monster-section{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
.ctn .choice-sec{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
.ctn details{display:block!important;width:100%!important}
.ctn details>summary{display:flex!important;width:100%!important}
.ctn details>.section-content{display:block!important;width:100%!important}

.is-user > div,
.is-assistant > div{display:block!important;width:100%!important;max-width:100%!important}
.rili-markdown-renderer{display:block!important;width:100%!important;max-width:100%!important}
.rili-markdown-renderer>div{display:block!important;width:100%!important;max-width:100%!important}

/* === 修复1：解决pop被后续元素遮挡 === */
.ctn .tip:hover{
  z-index:9999!important;
}

/* :has() 把所有可能的祖先容器在悬停时提层 */
.ctn details:has(.tip:hover),
.ctn .section:has(.tip:hover),
.ctn .section-content:has(.tip:hover),
.ctn .subsection:has(.tip:hover),
.ctn .npc-card:has(.tip:hover),
.ctn .monster-card:has(.tip:hover),
.ctn .equip-grid:has(.tip:hover),
.ctn .equip-grid .eq:has(.tip:hover),
.ctn .list:has(.tip:hover),
.ctn .list li:has(.tip:hover),
.ctn .inv:has(.tip:hover),
.ctn .inv > div:has(.tip:hover),
.ctn .info-grid:has(.tip:hover),
.ctn .quest:has(.tip:hover),
.ctn .mem-sub:has(.tip:hover),
.ctn .mem-ct:has(.tip:hover){
  z-index:9999!important;
  position:relative!important;
  isolation:auto!important;
}

/* === 修复2：限制pop不超出父容器边界 === */

/* 缩小默认宽度 + 强制贴边收敛 */
.ctn .pop{
  width:min(280px, calc(100vw - 40px))!important;
  max-width:calc(100vw - 40px)!important;
}

/* 当.tip位于容器右半区时，可手动添加 .right 类让pop向左展开 */
.ctn .tip.right .pop,
.ctn .eq:nth-child(even) .tip .pop,    /* 装备格右列自动翻转 */
.ctn .info-grid > span:nth-child(even) .tip .pop{
  left:auto!important;
  right:0!important;
  transform:none!important;
}
.ctn .tip.right .pop::before,
.ctn .eq:nth-child(even) .tip .pop::before,
.ctn .info-grid > span:nth-child(even) .tip .pop::before{
  left:auto!important;
  right:14px!important;
  transform:none!important;
}

/* 当.tip位于容器左边缘附近时，可手动添加 .left 类向右展开 */
.ctn .tip.left .pop{
  left:0!important;
  right:auto!important;
  transform:none!important;
}
.ctn .tip.left .pop::before{
  left:14px!important;
  transform:none!important;
}