/* ==========================================
   引擎核心样式表 v3.0 (终极整合重构版)
   ========================================== */

/* --- 1. 动画定义 --- */
@keyframes heartbeat { 0%, 100% { border-color: #8a1c3f; } 50% { border-color: #ff3366; box-shadow: inset 0 0 80px rgba(255, 51, 102, 0.1); } }
@keyframes pulse-bar { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes flicker { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0.7; } }
@keyframes ambient-drift { 0%, 100% { opacity: 0.3; transform: translateX(0) translateY(0); } 50% { opacity: 0.6; transform: translateX(10px) translateY(-5px); } }

/* --- 2. 基础容器与领地生态 (统合四领地与魔界) --- */
ai { display: block; margin: 15px auto; max-width: 680px; background: linear-gradient(135deg, #121212 0%, #1a1a1a 100%); color: #d4d4d4; font-family: 'PingFang SC', 'Helvetica Neue', serif; border-radius: 12px; overflow: hidden; position: relative; box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(255, 255, 255, 0.05); transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); border: 1px solid #333; }

/* 领地色彩变量定义 */
ai[r="wind"] { --theme: #88d4c1; --glow: rgba(136, 212, 193, 0.4); }
ai[r="forest"] { --theme: #85b072; --glow: rgba(133, 176, 114, 0.4); }
ai[r="fire"] { --theme: #e25822; --glow: rgba(226, 88, 34, 0.4); }
ai[r="mount"] { --theme: #b89947; --glow: rgba(184, 153, 71, 0.4); }
ai[r="demon"] { --theme: #8c9299; --glow: rgba(140, 146, 153, 0.3); border-color: #3a3b3e; background: linear-gradient(135deg, #0d0d0f 0%, #151618 100%); } /* 魔界统合完毕 */

ai[t="city"] { border: 1px solid var(--theme); box-shadow: 0 10px 30px rgba(0,0,0,0.6), inset 0 0 20px var(--glow); }
ai[t="city"]::before { content: "ADMINISTRATIVE CORE"; position: absolute; top: 0; right: 20px; background: var(--theme); color: #000; font-size: 9px; font-weight: bold; padding: 2px 8px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; letter-spacing: 1px; }
ai[m="special"] { --theme: #ff4d85 !important; --glow: rgba(255, 77, 133, 0.3) !important; background: radial-gradient(circle at center, #1a0b12 0%, #0a0205 100%); border: 1px solid #8a1c3f; animation: heartbeat 3s infinite ease-in-out; }

/* --- 3. 头部与正文区 --- */
hd { display: flex; flex-direction: column; gap: 6px; padding: 18px 24px; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,0.08); position: relative; }
hd::after { content: ""; position: absolute; top: 10px; left: 20px; width: 60px; height: 60px; background: radial-gradient(circle, var(--glow) 0%, transparent 70%); border-radius: 50%; animation: ambient-drift 6s infinite ease-in-out; pointer-events: none; opacity: 0.4; }
hd l { display: block; font-size: 16px; color: var(--theme); font-weight: 600; letter-spacing: 2px; text-shadow: 0 0 10px var(--glow); }
hd t { display: block; font-size: 12px; color: #888; letter-spacing: 1px; text-transform: uppercase; }
hd v { display: inline-block; font-size: 11px; color: #bbb; background: rgba(255, 255, 255, 0.04); padding: 4px 10px; border-radius: 4px; border-left: 2px solid var(--theme); width: fit-content; margin-top: 4px; }
txt { display: block; padding: 30px 40px; line-height: 1.85; font-size: 15px; color: #cecece; text-align: justify; position: relative; z-index: 1; }
txt::first-letter { font-size: 2.8em; color: var(--theme); float: left; margin: 4px 8px 0 0; line-height: 1; text-shadow: 0 0 10px var(--glow); font-family: 'Times New Roman', serif; }
hr.scene { border: none; height: 1px; background: linear-gradient(90deg, transparent, var(--theme), transparent); margin: 28px 0; opacity: 0.5; }
txt gh { color: #50e3c2; font-weight: 500; font-style: italic; }
txt npc { display: inline; color: #e8c872; font-weight: 500; }
txt inner { display: block; font-style: italic; color: #8899aa; border-left: 2px solid rgba(136, 153, 170, 0.3); padding-left: 12px; margin: 12px 0; font-size: 14px; }

/* --- 4. 终端面板装甲系统 (整合主折叠与子折叠) --- */
dt { padding: 0 20px 20px; }
/* 击杀原生三角 */
acc summary, details.sub > summary, details.inv-item > summary { list-style: none !important; }
acc summary::-webkit-details-marker, details.sub > summary::-webkit-details-marker, details.inv-item > summary::-webkit-details-marker { display: none !important; }

/* 主折叠装甲 */
acc > details { background: rgba(15, 20, 25, 0.6) !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; border-radius: 6px !important; margin-bottom: 12px !important; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important; }
acc > details:not(.sub):not(.inv-item) > summary { padding: 12px 15px !important; background: linear-gradient(90deg, rgba(30, 45, 60, 0.8) 0%, rgba(15, 20, 25, 0.8) 100%) !important; font-size: 15px !important; font-weight: 700 !important; color: #e0e6ed !important; letter-spacing: 1px; border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important; border-left: 4px solid var(--theme) !important; display: flex !important; align-items: center !important; }
acc > details:not(.sub):not(.inv-item) > summary::after { content: "▼" !important; margin-left: auto !important; font-size: 12px !important; color: #667788 !important; transition: transform 0.3s ease, color 0.3s ease !important; }
acc > details:not(.sub):not(.inv-item)[open] > summary::after { transform: rotate(180deg) !important; color: var(--theme) !important; }

/* 子折叠树状结构 */
acc > details > panel { padding: 10px 10px 10px 20px !important; border-left: 2px dashed rgba(255, 255, 255, 0.15) !important; margin-left: 12px !important; margin-top: 5px; display: block; }
details.sub { background: transparent !important; border: none !important; border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important; margin-bottom: 4px !important; box-shadow: none !important; }
details.sub > summary { padding: 8px 10px !important; font-size: 13px !important; color: #99aabb !important; display: flex !important; align-items: center !important; gap: 8px !important; }
details.sub > summary::before { content: "└" !important; color: rgba(255, 255, 255, 0.3); font-size: 12px; }
details.sub > summary::after { content: "▼" !important; font-size: 10px; color: #555; margin-left: auto !important; transition: transform 0.3s; }
details.sub[open] > summary { color: var(--theme) !important; background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, transparent 100%); }
details.sub[open] > summary::before, details.sub[open] > summary::after { color: var(--theme) !important; }
details.sub[open] > summary::after { transform: rotate(180deg) !important; }
.sub-content { padding: 10px 10px 15px 24px !important; }

/* --- 5. 信息行与标签 --- */
row { display: block; font-size: 13.5px; margin: 5px 0; color: #a0a0a0; }
row b { color: #d0d0d0; margin-right: 6px; font-weight: 500; }
row.hidden { color: transparent; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 4px; padding: 4px 8px; margin-top: 6px; cursor: help; transition: all 0.4s; position: relative; }
row.hidden::before { content: "🔒 [感官/私密数据] 悬停探查"; color: #888; font-size: 12px; position: absolute; transition: opacity 0.3s; }
row.hidden:hover { color: #e8b0b0; background: rgba(255, 77, 133, 0.08); border-color: rgba(255, 77, 133, 0.3); text-shadow: none; }
row.hidden:hover::before { opacity: 0; pointer-events: none; }
stat-e { color: #b08bb6; font-weight: 600; text-shadow: 0 0 8px rgba(176, 139, 182, 0.5); animation: heartbeat 4s infinite alternate; }

/* 模块盒 */
mod { display: block; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; position: relative; overflow: hidden; }
mod::before { content: attr(label); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: #666; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); }

/* --- 6. 战术行囊系统 (Inventory) --- */
.inv-list { display: flex; flex-direction: column; gap: 6px; margin-top: 5px; }
details.inv-item { background: rgba(0, 0, 0, 0.3); border-radius: 4px; border: 1px solid rgba(255,255,255,0.03); }
details.inv-item > summary { padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; border-left: 3px solid transparent; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
details.inv-item:hover > summary { background: rgba(255, 255, 255, 0.05); }
details.inv-item > summary::after { content: "▼"; font-size: 10px; color: #555; transition: transform 0.3s; }
details.inv-item[open] > summary::after { transform: rotate(180deg); }
details.inv-item.common > summary { color: #b3b3b3; border-left-color: #777; }
details.inv-item.rare > summary { color: #50e3c2; border-left-color: #50e3c2; text-shadow: 0 0 5px rgba(80,227,194,0.3); }
details.inv-item.epic > summary { color: #b08bb6; border-left-color: #b08bb6; text-shadow: 0 0 5px rgba(176,139,182,0.3); }
details.inv-item.special > summary { color: #ff8b94; border-left-color: #ff8b94; text-shadow: 0 0 5px rgba(255,139,148,0.3); background: linear-gradient(90deg, rgba(255,139,148,0.05) 0%, transparent 100%); }
.inv-desc { padding: 10px 12px; background: rgba(0, 0, 0, 0.4); font-size: 12px; color: #a0a0a0; line-height: 1.6; border-top: 1px dashed rgba(255,255,255,0.08); }
.inv-desc i { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.05); color: #8899aa; font-style: italic; }

/* --- 7. 角色卡片 --- */
char-card { display: flex; flex-direction: column; background: linear-gradient(145deg, rgba(20,20,20,0.6) 0%, rgba(10,10,10,0.8) 100%); border: 1px solid rgba(255, 255, 255, 0.05); border-left: 3px solid var(--theme); border-radius: 8px; padding: 14px; box-shadow: 0 4px 15px rgba(0,0,0,0.4); transition: all 0.3s ease; }
char-card:hover { transform: translateX(4px); border-color: rgba(255,255,255,0.15); box-shadow: inset 0 0 15px var(--glow); }
char-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px dashed rgba(255, 255, 255, 0.1); padding-bottom: 8px; }
char-name { font-weight: 600; color: #eaeaea; font-size: 15px; }
char-stats { display: flex; gap: 12px; font-size: 12.5px; font-family: monospace; }
char-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
char-tag { font-size: 11px; color: #b3b3b3; background: rgba(255, 255, 255, 0.04); padding: 3px 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); }
char-tag.secret { color: #e8b0b0; border-color: rgba(255, 77, 133, 0.4); background: rgba(255, 77, 133, 0.05); }
char-desc { font-size: 13px; color: #999; line-height: 1.6; }

/* --- 8. 抉择操作区 --- */
sec { display: block; background: rgba(0, 0, 0, 0.2); margin-top: 12px; padding: 16px; border-radius: 6px; border-left: 3px solid var(--theme); box-shadow: inset 1px 1px 0 rgba(255,255,255,0.02); }
sec f { display: block; font-weight: 600; color: var(--theme); margin-bottom: 8px; font-size: 14px; letter-spacing: 1px; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 4px; }
opt { display: flex; align-items: center; margin: 10px 0; padding: 12px 16px; background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, transparent 100%); border: 1px solid rgba(255,255,255,0.05); border-radius: 4px; font-size: 14px; cursor: pointer; color: #ccc; transition: all 0.3s; }
opt::before { content: "▸"; margin-right: 10px; color: var(--theme); font-size: 16px; }
opt:hover { border-color: var(--theme); background: linear-gradient(90deg, var(--glow) 0%, transparent 100%); color: #fff; padding-left: 20px; }
opt.lewd { border-left: 3px solid #ff4d85; } opt.lewd::before { content: "♡"; color: #ff4d85; }
opt.lewd:hover { background: linear-gradient(90deg, rgba(255, 77, 133, 0.1) 0%, transparent 100%); border-color: #ff4d85; }
opt.insight { border-left: 3px solid #50e3c2; } opt.insight::before { content: "◈"; color: #50e3c2; }
opt.insight:hover { background: linear-gradient(90deg, rgba(80, 227, 194, 0.1) 0%, transparent 100%); border-color: #50e3c2; }