ai {
  --bg: #0f0d14;         /* 深渊暗底 */
  --panel: #1a1625;      /* 面板底色 */
  --main: #9b72cf;       /* 威压紫 */
  --acc: #e63946;        /* 警示红/觉醒红 */
  --text: #d3cce3;       /* 灰白字 */
  --border: #352a4a;     /* 暗紫边框 */
  
  display: block;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0,0,0,0.6), inset 0 0 15px rgba(155,114,207,0.05);
  line-height: 1.5;
}

/* 头部信息区 */
ai hd {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
ai hd t { font-size: 12px; color: #8a7b9d; font-weight: bold; }
ai hd l { font-size: 13px; color: #bbaed2; }
ai hd n { 
  font-size: 13px; 
  color: var(--main); 
  background: rgba(155,114,207,0.15); 
  padding: 4px 8px; 
  border-radius: 4px; 
  border-left: 3px solid var(--main);
  width: fit-content;
}

/* 封印觉醒进度条 */
ai bar {
  position: relative;
  height: 22px;
  background: #000;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
ai bar b {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    var(--acc),
    var(--acc) 10px,
    #bd2a36 10px,
    #bd2a36 20px
  );
  box-shadow: 0 0 10px var(--acc);
  transition: width 0.5s ease;
  z-index: 1;
}
ai bar span {
  position: relative;
  z-index: 2;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

/* 叙事正文 */
ai article {
  display: block;
  font-size: 15px;
  line-height: 1.7;
  color: #e5e1f0;
  margin: 15px 0;
  text-align: justify;
}
ai article p { margin: 8px 0; }

/* 折叠面板通用 */
ai details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
}
ai details details {
  margin: 8px;
  border-style: dashed;
}
ai summary {
  padding: 10px 12px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(90deg, #251c36, transparent);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: 0.3s;
}
ai summary::-webkit-details-marker { display: none; }
ai summary:hover { text-shadow: 0 0 8px var(--main); }
ai details[open] > summary { border-bottom: 1px solid var(--border); }

/* 主角状态键值对 */
ai p {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  margin: 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
ai p:last-child { border-bottom: none; }
ai p d { color: #8a7b9d; font-size: 13px; }
ai p v { color: #d3cce3; font-weight: 500; text-align: right; }

/* 在场角色卡片 */
ai c {
  display: block;
  padding: 10px;
  margin: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  border-left: 3px solid var(--main);
}
ai c n { display: block; font-weight: bold; color: #fff; margin-bottom: 4px; }
ai c s { display: block; font-size: 12px; color: #bbaed2; margin-bottom: 6px; }
ai c q {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: #988ca8;
  background: rgba(255,255,255,0.03);
  padding: 6px 8px;
  border-radius: 4px;
}

/* 网格系统 (好感度 & 记忆) */
ai g, ai m { display: block; padding: 8px; }
ai r {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1.5fr; /* 角色表列宽分配 */
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
  align-items: center;
}
ai m r { grid-template-columns: 30px 80px 1fr; } /* 记忆表列宽分配 */
ai r:last-child { border-bottom: none; }
ai r b { color: var(--main); font-size: 12px; }
ai r span { word-break: break-all; }

/* 行动脚本 */
ai act { display: block; padding: 8px; }
ai act d {
  display: block;
  padding: 8px;
  margin-bottom: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  transition: 0.2s;
  cursor: pointer;
}
ai act d:hover {
  background: rgba(155,114,207,0.15);
  padding-left: 12px;
  border-left: 2px solid var(--main);
}
ai act i {
  color: var(--main);
  font-weight: bold;
  font-style: normal;
  margin-right: 6px;
}
ai act i.sp { color: var(--acc); } /* 特殊行动如[反击]标红 */

/* 长期记忆 */
ai long {
  display: block;
  padding: 12px;
  font-size: 13px;
  color: #8a7b9d;
  line-height: 1.6;
  white-space: pre-wrap;
}