/* ═══════════════════════════════════════════════════════════
   玉女经·苏灵韵 世界引擎 · 完整视觉皮肤
   ─────────────────────────────────────────
   冰玉仙侠 × 欲宗魅影

   目录：
   [0] 全局变量
   [1] 正文容器
   [2] details 面板卡片
   [3] summary 标题栏
   [4] 状态字段行（美化·双栏）
   [5] 进度条（通用 / 羞耻 / 情欲）
   [6] 角色着色（苏灵韵 / 玩家 / NPC）
   [7] 强调标记（危机 / 高光）
   [8] 星记忆表格
   [9] 顶层面板强化 & 移动端适配
   [10] 亲密模式皮肤（桃色暖光·class 开关）

   容器前缀说明：默认用 .mes_text（SillyTavern）
   其他平台请全局替换 .mes_text 为你的消息容器 class

   ✦ 白底适配：文字深色+重阴影保证可读性
═══════════════════════════════════════════════════════════ */

/* ═══ [0] 全局变量 ═══ */
:root {
  --jade-deep:   #0a4048;   /* 玉青·深（白底加深） */
  --jade-mid:    #16484d;   /* 玉青·中 */
  --jade-glow:   #2d9c8e;   /* 玉光（白底加深） */
  --frost:       #1a3a3d;   /* 霜白→深墨（白底反转） */
  --lust-rose:   #c8376d;   /* 欲宗·桃（白底加深） */
  --lust-purple: #6b2d7e;   /* 欲宗·紫（白底加深） */
  --gold:        #b58a2f;   /* 记忆金（白底加深） */
  --warn-red:    #d93636;   /* 危机红（白底加深） */
  --ink:         #2b4a4f;   /* 正文墨（白底深化） */
  --panel-bg:    rgba(245, 250, 252, 0.95);
  --panel-line:  rgba(45, 156, 142, 0.35);
}

/* ═══ [1] 正文容器 ═══ */
.mes_text, .prose {
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

.mes_text p {
  margin: 0 0 1em 0;
  text-align: justify;
}

/* ═══ [2] details 面板卡片 ═══ */
.mes_text details {
  margin: 12px 0;
  padding: 0;
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(6px);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.mes_text details:hover {
  border-color: var(--jade-glow);
  box-shadow:
    0 6px 26px rgba(0, 0, 0, 0.18),
    0 0 18px rgba(45, 156, 142, 0.25);
}

/* 嵌套子面板 */
.mes_text details details {
  margin: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
}

/* 面板内边距 */
.mes_text details > *:not(summary):not(details) {
  padding-left: 16px;
  padding-right: 16px;
}
.mes_text details > *:not(summary):first-of-type { margin-top: 12px; }
.mes_text details > *:not(summary):last-child { margin-bottom: 14px; }

/* ═══ [3] summary 标题栏 ═══ */
.mes_text summary {
  cursor: pointer;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.96em;
  color: var(--frost);
  background: linear-gradient(
    100deg,
    rgba(45, 156, 142, 0.15),
    rgba(22, 72, 77, 0.08)
  );
  border-bottom: 1px solid transparent;
  list-style: none;
  user-select: none;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease;
}

.mes_text summary::-webkit-details-marker { display: none; }

.mes_text summary::before {
  content: "◈";
  color: var(--jade-glow);
  margin-right: 8px;
  font-size: 0.8em;
  opacity: 0.8;
  transition: transform 0.3s ease;
}

.mes_text details[open] > summary {
  border-bottom-color: var(--panel-line);
  color: var(--jade-glow);
}

.mes_text details[open] > summary::before {
  transform: rotate(90deg);
  opacity: 1;
}

.mes_text summary:hover {
  background: linear-gradient(
    100deg,
    rgba(45, 156, 142, 0.22),
    rgba(22, 72, 77, 0.12)
  );
}

/* ═══ [4] 状态字段行·美化双栏 ═══ */
.mes_text details p strong,
.mes_text details strong {
  color: var(--jade-glow);
  font-weight: 700;
  display: inline-block;
  min-width: 4.5em;
  margin-right: 0.5em;
  position: relative;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.mes_text details p strong::after,
.mes_text details strong::after {
  content: "·";
  color: var(--jade-glow);
  opacity: 0.4;
  margin-left: 0.3em;
}

/* 双栏布局容器（可选：给状态密集的面板用） */
.mes_text details .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 16px;
  font-size: 0.92em;
}

.mes_text details .stat-grid p {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px dotted rgba(45, 156, 142, 0.15);
}

/* 状态图标点缀（可选） */
.mes_text details p[data-icon]::before {
  content: attr(data-icon);
  margin-right: 6px;
  opacity: 0.7;
}

/* ═══ [5] 进度条·全新气泡 ═══ */
/* ---- 通用进度条气泡 ---- */
.bar {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(240,248,250,0.9));
  border: 1.5px solid transparent;
  background-clip: padding-box;
  position: relative;
  vertical-align: middle;
  letter-spacing: -1px;
  box-shadow:
    0 2px 8px rgba(45, 156, 142, 0.15),
    inset 0 1px 2px rgba(255,255,255,0.8);
  transition: all 0.3s ease;
}

.bar::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 20px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--jade-glow), var(--jade-mid));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  animation: bordershine 3s ease-in-out infinite;
}

@keyframes bordershine {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}

.bar:hover {
  box-shadow:
    0 4px 14px rgba(45, 156, 142, 0.25),
    inset 0 1px 2px rgba(255,255,255,0.9);
  transform: translateY(-1px);
}

.bf {
  color: var(--jade-glow);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(45, 156, 142, 0.4);
  filter: drop-shadow(0 0 4px rgba(45, 156, 142, 0.3));
  animation: barpulse 2.6s ease-in-out infinite;
}

.be {
  color: rgba(45, 156, 142, 0.25);
  font-weight: 500;
}

@keyframes barpulse {
  0%, 100% {
    opacity: 0.85;
    filter: drop-shadow(0 0 4px rgba(45, 156, 142, 0.3));
  }
  50%      {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(45, 156, 142, 0.6));
  }
}

/* ---- 羞耻进度条·粉色脸红 ---- */
.bar.shame {
  background: linear-gradient(135deg, rgba(255,245,250,0.95), rgba(255,235,245,0.9));
  box-shadow:
    0 2px 10px rgba(200, 55, 109, 0.2),
    inset 0 1px 2px rgba(255,255,255,0.8);
}

.bar.shame::before {
  background: linear-gradient(135deg, #ffb3d0, var(--lust-rose));
}

.bar.shame .bf {
  color: var(--lust-rose);
  text-shadow: 0 1px 3px rgba(200, 55, 109, 0.4);
  filter: drop-shadow(0 0 6px rgba(255, 126, 179, 0.5));
  animation: shameblush 1.8s ease-in-out infinite;
}

.bar.shame .be {
  color: rgba(200, 55, 109, 0.25);
}

@keyframes shameblush {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 4px rgba(255, 126, 179, 0.4));
  }
  50%      {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 126, 179, 0.7));
  }
}

/* ---- 情欲进度条·深桃流动 ---- */
.bar.lust {
  background: linear-gradient(135deg, rgba(255,240,248,0.95), rgba(255,230,245,0.9));
  box-shadow:
    0 2px 10px rgba(200, 55, 109, 0.25),
    inset 0 1px 2px rgba(255,255,255,0.8);
  animation: lustglow 3s ease-in-out infinite;
}

.bar.lust::before {
  background: linear-gradient(135deg, #ff9ec4, var(--lust-rose), #ff9ec4);
  background-size: 200% 100%;
  animation: lustflow 4s linear infinite;
}

@keyframes lustglow {
  0%, 100% {
    box-shadow:
      0 2px 10px rgba(200, 55, 109, 0.2),
      inset 0 1px 2px rgba(255,255,255,0.8);
  }
  50% {
    box-shadow:
      0 4px 16px rgba(200, 55, 109, 0.35),
      0 0 12px rgba(255, 158, 196, 0.3),
      inset 0 1px 2px rgba(255,255,255,0.9);
  }
}

.bar.lust .bf {
  background: linear-gradient(90deg, var(--lust-rose), #ff9ec4, var(--lust-rose));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  animation: lustflow 3s linear infinite;
  filter: drop-shadow(0 1px 3px rgba(200, 55, 109, 0.4));
}

.bar.lust .be {
  color: rgba(200, 55, 109, 0.25);
}

@keyframes lustflow {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ═══ [6] 角色着色 ═══ */
/* ---- 苏灵韵·冰玉 ---- */
.sly-name {
  color: #2d7a9e;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(45, 122, 158, 0.4);
  padding: 0 2px;
}
.sly-talk {
  color: #3a8eb0;
  font-style: normal;
  text-shadow: 0 1px 2px rgba(58, 142, 176, 0.3);
}
.sly-mind {
  color: #4a9ab8;
  font-style: italic;
  opacity: 0.92;
}

/* ---- 玩家·记忆金 ---- */
.pc-name {
  color: var(--gold);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(181, 138, 47, 0.4);
  padding: 0 2px;
}
.pc-talk {
  color: #c69640;
  font-style: normal;
}

/* ---- 其他角色·欲宗魅影 ---- */
.npc-talk {
  color: var(--lust-rose);
  font-style: normal;
  text-shadow: 0 1px 2px rgba(200, 55, 109, 0.3);
}
.npc-mind {
  color: #a8537e;
  font-style: italic;
  opacity: 0.9;
}

/* ═══ [7] 强调标记 ═══ */
.warn {
  color: var(--warn-red);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(217, 54, 54, 0.5);
  animation: warnflash 1.4s ease-in-out infinite;
}
@keyframes warnflash {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

.hl {
  color: var(--frost);
  background: linear-gradient(
    120deg,
    rgba(200, 55, 109, 0.15),
    rgba(107, 45, 126, 0.15)
  );
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  border-left: 3px solid var(--lust-rose);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ═══ [8] 星记忆表格 ═══ */
.mes_text table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.86em;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.mes_text th {
  background: linear-gradient(100deg, var(--lust-purple), var(--jade-mid));
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.mes_text td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(45, 156, 142, 0.12);
  color: var(--ink);
  background: rgba(255,255,255,0.5);
}
.mes_text tr:nth-child(even) td {
  background: rgba(245, 250, 252, 0.8);
}
.mes_text tr:hover td {
  background: rgba(220, 242, 245, 0.6);
}

/* ═══ [9] 顶层面板强化 & 移动端适配 ═══ */
.mes_text > details:nth-of-type(2),  /* 主角 */
.mes_text > details:nth-of-type(3) { /* 苏灵韵 */
  border-width: 1.5px;
  border-color: var(--jade-glow);
}

@media (max-width: 520px) {
  .mes_text summary { padding: 9px 12px; font-size: 0.9em; }
  .mes_text details > *:not(summary):not(details) {
    padding-left: 12px; padding-right: 12px;
  }
  .bar { margin-left: 6px; padding: 2px 6px; }
  .mes_text details .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════
   [10] 亲密模式皮肤 · 桃色暖光
   ─────────────────────────────────────────
   触发方式（三选一）：
   A. 自动：情欲≥60时让引擎给消息容器加 class="intimate"
   B. 打标：进度条直接用 class="bar shame" / "bar lust"（已在[5]生效）
   C. 手动：手动给消息加 intimate class
═══════════════════════════════════════════════════════════ */

/* ---- 变量覆写 ---- */
.mes_text.intimate {
  --jade-glow:   #d6548a;   /* 玉光→桃光 */
  --frost:       #5a2438;   /* 霜白→深桃墨 */
  --ink:         #6d3d52;   /* 正文墨→暖桃墨 */
  --panel-bg:    rgba(255, 245, 250, 0.95);
  --panel-line:  rgba(214, 84, 138, 0.35);
}

/* ---- 整体暖光呼吸 ---- */
.mes_text.intimate {
  animation: intimateglow 6s ease-in-out infinite;
}
@keyframes intimateglow {
  0%, 100% {
    box-shadow: inset 0 0 40px rgba(255, 182, 208, 0.12);
  }
  50%      {
    box-shadow: inset 0 0 60px rgba(255, 182, 208, 0.22);
  }
}

/* ---- 面板转桃调 ---- */
.mes_text.intimate details {
  border-color: rgba(214, 84, 138, 0.4);
  background: rgba(255, 250, 253, 0.95);
  box-shadow:
    0 4px 20px rgba(200, 55, 109, 0.15),
    0 0 24px rgba(255, 182, 208, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.mes_text.intimate details:hover {
  border-color: #d6548a;
  box-shadow:
    0 6px 28px rgba(200, 55, 109, 0.22),
    0 0 28px rgba(255, 182, 208, 0.25);
}
.mes_text.intimate details details {
  background: rgba(255, 245, 250, 0.7);
}

/* ---- summary 桃调 ---- */
.mes_text.intimate summary {
  color: var(--frost);
  background: linear-gradient(
    100deg,
    rgba(255, 182, 208, 0.25),
    rgba(245, 210, 225, 0.15)
  );
}
.mes_text.intimate summary::before { color: #d6548a; }
.mes_text.intimate details[open] > summary { color: #d6548a; }
.mes_text.intimate summary:hover {
  background: linear-gradient(
    100deg,
    rgba(255, 182, 208, 0.35),
    rgba(245, 210, 225, 0.22)
  );
}
.mes_text.intimate details strong { color: #d6548a; }

/* ---- 通用进度条转桃 ---- */
.mes_text.intimate .bar::before {
  background: linear-gradient(135deg, #ffb3d0, #d6548a);
}

.mes_text.intimate .bf {
  color: #d6548a;
  text-shadow: 0 1px 3px rgba(214, 84, 138, 0.4);
  filter: drop-shadow(0 0 6px rgba(255, 158, 196, 0.4));
  animation: barpulse-rose 2.4s ease-in-out infinite;
}
@keyframes barpulse-rose {
  0%, 100% {
    opacity: 0.85;
    filter: drop-shadow(0 0 4px rgba(255, 158, 196, 0.3));
  }
  50%      {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 158, 196, 0.6));
  }
}

/* ---- 苏灵韵着色·亲密微调 ---- */
.mes_text.intimate .sly-name {
  color: #8a5a78;
  text-shadow: 0 1px 3px rgba(138, 90, 120, 0.4);
}
.mes_text.intimate .sly-talk {
  color: #9a6a88;
  text-shadow: 0 1px 2px rgba(154, 106, 136, 0.3);
}
.mes_text.intimate .sly-mind {
  color: #b07a9a;
  font-style: italic;
}

/* ---- 玩家金色保留·冷暖对撞的锚 ---- */
.mes_text.intimate .pc-name {
  color: #b58a2f;
  text-shadow: 0 1px 3px rgba(181, 138, 47, 0.5);
}

/* ---- 私密花园面板·亲密高亮 ---- */
.mes_text.intimate details[data-zone="garden"] > summary {
  background: linear-gradient(
    100deg,
    rgba(255, 182, 208, 0.45),
    rgba(245, 200, 220, 0.28)
  );
  border-bottom-color: rgba(214, 84, 138, 0.3);
}

.mes_text.intimate details[data-zone="garden"]:hover {
  box-shadow:
    0 6px 28px rgba(200, 55, 109, 0.28),
    0 0 32px rgba(255, 158, 196, 0.35);
}