/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   《夜之母：禁忌的永恒摇篮》专用CSS - 哥特温馨与血月情欲美学
   配色：月光银白 × 鲜血深红 × 永恒暗紫 × 温暖乳黄
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ========== 变量定义 ========== */
ai {
  --moon-silver: linear-gradient(135deg, #F8F8FF 0%, #E6E6FA 30%, #DCDCDC 100%);
  --blood-red: linear-gradient(135deg, #8B0000 0%, #B22222 40%, #DC143C 100%);
  --ethereal-purple: linear-gradient(135deg, #9370DB 0%, #8A2BE2 50%, #4B0082 100%);
  --warm-cream: linear-gradient(135deg, #FFF5EE 0%, #FFE4C4 30%, #F5DEB3 100%);
  --vampire-bg: linear-gradient(135deg, #2F2F3F 0%, #1A1A2E 50%, #0F0F1A 100%);
  --shadow-gothic: rgba(0, 0, 0, 0.4);
  --shadow-soft: rgba(139, 0, 0, 0.2);
  --spacing-s: 8px;
  --spacing-m: 14px;
  --spacing-l: 20px;
  --border-thin: 1px solid rgba(220, 20, 60, 0.3);
  --border-med: 2px solid rgba(139, 0, 0, 0.5);
  display: block;
  max-width: 720px;
  margin: 20px auto;
  padding: 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: #F0E6D6;
  background: var(--vampire-bg);
  border: 4px solid #8B0000;
  border-radius: 0 15px 15px 0;
  box-shadow: 
    0 8px 30px var(--shadow-gothic),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset -10px 0 20px rgba(139, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  font-family: 'Hiragino Sans GB', 'Microsoft YaHei', 'Georgia', serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 哥特式纹理与血月背景 */
ai::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    url("data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='gothic' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M20,0 L40,20 L20,40 L0,20 Z' fill='none' stroke='%238B0000' stroke-width='0.8' opacity='0.1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23gothic)'/%3E%3C/svg%3E"),
    radial-gradient(circle at 85% 15%, rgba(139, 0, 0, 0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

ai > * {
  position: relative;
  z-index: 1;
}

/* 左侧血月装饰条 */
ai::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(180deg, 
    #8B0000 0%, 
    #B22222 20%, 
    #DC143C 40%, 
    #FF6B6B 60%, 
    #DC143C 80%, 
    #8B0000 100%);
  box-shadow: inset -2px 0 10px rgba(0, 0, 0, 0.5);
  z-index: 0;
}

/* ========== 前置状态栏 ========== */
ai pre.top {
  margin: 0;
  padding: var(--spacing-l) var(--spacing-m);
  background: linear-gradient(135deg, 
    rgba(47, 47, 63, 0.95) 0%, 
    rgba(26, 26, 46, 0.95) 100%);
  border: none;
  border-bottom: 3px solid #DC143C;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #FFDAB9;
  box-shadow: 
    inset 0 -3px 10px rgba(220, 20, 60, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  text-shadow: 0 0 5px rgba(255, 20, 147, 0.3);
}

/* 血滴装饰动画 */
ai pre.top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: url("data:image/svg+xml,%3Csvg width='200' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,6 Q10,0 20,6 T40,6 T60,6 T80,6 T100,6 T120,6 T140,6 T160,6 T180,6 T200,6' stroke='%23DC143C' fill='none' stroke-width='2' opacity='0.8' stroke-dasharray='2,4'/%3E%3C/svg%3E") repeat-x;
  background-size: 200px 12px;
  animation: bloodDrip 15s infinite linear;
}

@keyframes bloodDrip {
  0% { background-position: 0 0; }
  100% { background-position: 200px 0; }
}

/* 好感度与魔力值图标 */
ai pre.top::after {
  content: '🩸💗';
  position: absolute;
  top: 50%;
  right: var(--spacing-l);
  font-size: 20px;
  filter: drop-shadow(0 0 6px rgba(220, 20, 60, 0.7));
  animation: heartbeat 1.5s infinite ease-in-out;
  transform: translateY(-50%);
}

@keyframes heartbeat {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.1); }
}

/* 数值高亮 */
ai pre.top strong {
  color: #FF69B4;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255, 105, 180, 0.5);
}

/* ========== 正文区域 ========== */
ai text {
  display: block;
  padding: var(--spacing-l) var(--spacing-m);
  background: rgba(30, 30, 46, 0.7);
  border-bottom: 1px dashed #8B4513;
  min-height: 300px;
}

ai text p {
  margin: 0 0 var(--spacing-m) 0;
  text-indent: 2.2em;
  text-align: justify;
  color: #F5F5DC;
}

ai text p:last-child {
  margin-bottom: 0;
}

/* 对话颜色（已内嵌在提示词中，此处为增强） */
ai text span[style*="color:#4A90E2"] {
  text-shadow: 0 0 3px rgba(74, 144, 226, 0.4);
  font-weight: 500;
}

ai text span[style*="color:#E75480"] {
  text-shadow: 0 0 4px rgba(231, 84, 128, 0.5);
  font-style: italic;
  position: relative;
}

ai text span[style*="color:#E75480"]::before {
  content: '❣️';
  margin-right: 4px;
  font-size: 0.9em;
  vertical-align: text-top;
}

ai text span[style*="color:#9B59B6"] {
  text-shadow: 0 0 3px rgba(155, 89, 182, 0.4);
  opacity: 0.9;
  font-style: italic;
}

/* 重点词汇高亮 */
ai text strong {
  color: #FFB6C1;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(255, 182, 193, 0.4);
}

/* ========== 折叠块通用样式 ========== */
ai details {
  margin: var(--spacing-m);
  background: linear-gradient(135deg, 
    rgba(50, 50, 70, 0.9) 0%, 
    rgba(35, 35, 55, 0.9) 100%);
  border: 2px solid #8B4513;
  border-radius: 8px 0 8px 8px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

ai details:hover {
  border-color: #DC143C;
  box-shadow: 0 6px 20px rgba(220, 20, 60, 0.25);
}

ai details summary {
  padding: 14px var(--spacing-m);
  background: linear-gradient(90deg, 
    rgba(139, 0, 0, 0.3) 0%, 
    rgba(178, 34, 34, 0.2) 50%,
    rgba(139, 0, 0, 0.1) 100%);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 15.5px;
  color: #FFDAB9;
  position: relative;
  user-select: none;
  transition: all 0.4s ease;
  border-left: 6px solid transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

ai details summary::-webkit-details-marker {
  display: none;
}

/* 折叠箭头（蝙蝠/血滴） */
ai details summary::after {
  content: '🦇';
  position: absolute;
  right: var(--spacing-m);
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #FF6B6B;
  transition: transform 0.4s ease, color 0.4s ease;
  filter: drop-shadow(0 0 3px rgba(255, 107, 107, 0.5));
}

ai details[open] summary::after {
  content: '🩸';
  transform: translateY(-50%) rotate(90deg);
  color: #DC143C;
}

ai details summary:hover {
  background: linear-gradient(90deg, 
    rgba(220, 20, 60, 0.4) 0%, 
    rgba(255, 107, 107, 0.3) 100%);
  color: #FFFFFF;
}

/* 折叠内容 */
ai details section {
  padding: var(--spacing-l);
  animation: gothicReveal 0.5s ease-out;
  background: rgba(25, 25, 40, 0.8);
}

@keyframes gothicReveal {
  from {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* 展开时的血光效果 */
ai details[open] {
  border-color: #DC143C;
  box-shadow: 0 0 25px rgba(220, 20, 60, 0.35);
}

ai details[open] summary {
  border-bottom: 2px solid #8B4513;
  position: relative;
  overflow: hidden;
}

ai details[open] summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.15), 
    transparent);
  animation: bloodScan 1s ease-out;
}

@keyframes bloodScan {
  to { left: 100%; }
}

/* ========== 折叠块分类配色 ========== */
/* 夜的状态 */
ai details.summary[title*="夜的状态"],
ai details.summary:has(> summary:contains("状态")) {
  border-left-color: #DC143C;
}
ai details.summary[title*="夜的状态"] summary::before,
ai details.summary:has(> summary:contains("状态")) summary::before {
  content: '👁️';
  margin-right: 10px;
  font-size: 1.1em;
}

/* 记忆区 */
ai details.summary[title*="记忆区"],
ai details.summary:has(> summary:contains("记忆")) {
  border-left-color: #9370DB;
}
ai details.summary[title*="记忆区"] summary::before,
ai details.summary:has(> summary:contains("记忆")) summary::before {
  content: '🧠';
  margin-right: 10px;
  font-size: 1.1em;
}

/* 世界设定 */
ai details.summary[title*="世界设定"],
ai details.summary:has(> summary:contains("世界")) {
  border-left-color: #8A2BE2;
}
ai details.summary[title*="世界设定"] summary::before,
ai details.summary:has(> summary:contains("世界")) summary::before {
  content: '🌙';
  margin-right: 10px;
  font-size: 1.1em;
}

/* 孕期记录 */
ai details.summary[title*="孕期"],
ai details.summary:has(> summary:contains("孕期")) {
  border-left-color: #FF69B4;
}
ai details.summary[title*="孕期"] summary::before,
ai details.summary:has(> summary:contains("孕期")) summary::before {
  content: '🤰';
  margin-right: 10px;
  font-size: 1.1em;
}

/* 亲密记录 */
ai details.summary[title*="亲密"],
ai details.summary:has(> summary:contains("亲密")) {
  border-left-color: #FF1493;
}
ai details.summary[title*="亲密"] summary::before,
ai details.summary:has(> summary:contains("亲密")) summary::before {
  content: '💋';
  margin-right: 10px;
  font-size: 1.1em;
}

/* ========== 内容元素样式 ========== */
ai details h4 {
  margin: var(--spacing-l) 0 var(--spacing-s) 0;
  font-size: 16px;
  color: #FFB6C1;
  border-bottom: 2px solid rgba(255, 182, 193, 0.4);
  padding-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

ai details h4:first-child {
  margin-top: 0;
}

ai details ul {
  margin: 0;
  padding-left: 22px;
  list-style: none;
}

ai details ul li {
  margin: 8px 0;
  position: relative;
  padding-left: 18px;
  color: #E6D6B8;
}

ai details ul li::before {
  content: '🩸';
  position: absolute;
  left: 0;
  font-size: 12px;
  filter: drop-shadow(0 0 2px rgba(220, 20, 60, 0.5));
}

ai details ul ul {
  margin-top: 6px;
  border-left: 2px solid rgba(139, 0, 0, 0.3);
  padding-left: 20px;
  margin-left: 5px;
}

ai details strong {
  color: #FFD700;
  font-weight: 600;
}

ai details p {
  margin: 10px 0;
  color: #F5DEB3;
  line-height: 1.6;
}

/* 数值信息特殊样式 */
ai details li:has(strong:contains("好感度")),
ai details li:has(strong:contains("魔力")) {
  color: #98FB98;
}
ai details li:has(strong:contains("扣分")),
ai details li:has(strong:contains("危险")) {
  color: #FF6B6B;
}

/* ========== 表格样式（用于多结局/数值详情） ========== */
ai table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-m) 0;
  font-size: 14px;
  background: rgba(40, 40, 60, 0.8);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

ai table thead {
  background: linear-gradient(135deg, #8B0000 0%, #B22222 100%);
}

ai table th {
  padding: 12px 14px;
  font-weight: bold;
  text-align: left;
  color: #FFDAB9;
  border: 1px solid #DC143C;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

ai table td {
  padding: 12px 14px;
  border: 1px solid #8B4513;
  color: #F0E6D6;
  vertical-align: top;
}

ai table tbody tr:nth-child(odd) {
  background: rgba(60, 60, 80, 0.5);
}

ai table tbody tr:nth-child(even) {
  background: rgba(50, 50, 70, 0.5);
}

ai table tbody tr:hover {
  background: rgba(139, 0, 0, 0.3);
  transition: background 0.3s;
}

/* 结局表格特殊列 */
ai table td:nth-child(1):contains("永恒之家") {
  color: #98FB98;
}
ai table td:nth-child(1):contains("血裔王座") {
  color: #FFD700;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* ========== 行动选项 ========== */
ai pre.act {
  margin: var(--spacing-l);
  padding: var(--spacing-l);
  background: linear-gradient(135deg, 
    rgba(30, 30, 50, 0.95) 0%, 
    rgba(50, 30, 50, 0.95) 100%);
  border: 3px solid #8A2BE2;
  border-radius: 10px;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  font-size: 14.5px;
  white-space: pre-wrap;
  color: #E6D6B8;
  box-shadow: 
    0 8px 25px rgba(138, 43, 226, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

ai pre.act::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='choice' width='20' height='20' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='10' cy='10' r='1' fill='%238A2BE2' opacity='0.3'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23choice)'/%3E%3C/svg%3E");
  opacity: 0.2;
  z-index: 0;
}

ai pre.act > * {
  position: relative;
  z-index: 1;
}

/* 选项字母装饰 */
ai pre.act strong {
  color: #FF69B4;
  font-size: 16px;
  text-shadow: 0 0 8px rgba(255, 105, 180, 0.6);
  margin-right: 8px;
}

/* 选项悬停效果 */
ai pre.act strong:hover {
  color: #FFFFFF;
  cursor: pointer;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

/* ========== 响应式优化 ========== */
@media (max-width: 480px) {
  ai {
    font-size: 14.5px;
    margin: 12px auto;
    border-radius: 0 10px 10px 0;
    max-width: 96%;
    border-width: 3px;
  }
  
  ai pre.top,
  ai text,
  ai details section,
  ai pre.act {
    padding: 14px 12px;
  }
  
  ai details {
    margin: var(--spacing-s) 10px;
  }
  
  ai details summary {
    padding: 12px 14px;
    font-size: 14.5px;
  }
  
  ai table {
    font-size: 13.5px;
  }
  
  ai table th,
  ai table td {
    padding: 10px 12px;
  }
  
  ai::after {
    width: 8px;
  }
}

@media (min-width: 768px) {
  ai {
    max-width: 740px;
    margin: 25px auto;
  }
}

/* ========== 特殊增强效果 ========== */
/* 吸血文字脉动 */
ai text p:contains("吸") {
  animation: bloodPulse 3s infinite ease-in-out;
}

@keyframes bloodPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; text-shadow: 0 0 10px rgba(220, 20, 60, 0.5); }
}

/* 魔力值低警告 */
ai pre.top:contains("魔力稳定度") strong:contains("[0-9]") {
  position: relative;
}
ai pre.top:contains("魔力稳定度") strong:contains("[1-2][0-9]"),
ai pre.top:contains("魔力稳定度") strong:contains("[0-9]") {
  color: #FF6B6B !important;
  animation: dangerPulse 1s infinite alternate;
}

@keyframes dangerPulse {
  from { text-shadow: 0 0 5px rgba(255, 107, 107, 0.5); }
  to { text-shadow: 0 0 15px rgba(255, 107, 107, 0.8); }
}

/* 孕期特殊标记 */
ai details li:contains("孕期") {
  position: relative;
}
ai details li:contains("孕期")::after {
  content: '👶';
  position: absolute;
  right: 10px;
  font-size: 14px;
  filter: drop-shadow(0 0 3px rgba(255, 182, 193, 0.5));
}

/* 折叠块图标悬停动画 */
ai details summary:hover::before {
  display: inline-block;
  animation: vampFloat 0.8s ease-in-out;
}

@keyframes vampFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* 滚动条美化（哥特风） */
ai::-webkit-scrollbar {
  width: 12px;
}

ai::-webkit-scrollbar-track {
  background: rgba(30, 30, 46, 0.8);
  border-radius: 6px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}

ai::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8B0000, #DC143C, #8B0000);
  border-radius: 6px;
  border: 2px solid #2F2F3F;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.1);
}

ai::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #B22222, #FF6B6B, #B22222);
}

/* 打印优化 */
@media print {
  ai {
    border: 2px solid #8B0000;
    box-shadow: none;
    background: #FAFAFA;
    color: #333;
  }
  ai pre.top,
  ai details,
  ai pre.act {
    break-inside: avoid;
    background: #FFF !important;
    color: #000 !important;
  }
  ai::before,
  ai::after,
  ai pre.top::before,
  ai pre.top::after {
    display: none;
  }
}

/* 夜间模式增强（如果用户使用深色主题） */
@media (prefers-color-scheme: dark) {
  ai {
    --shadow-gothic: rgba(0, 0, 0, 0.6);
    box-shadow: 
      0 10px 35px var(--shadow-gothic),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  
  ai text {
    background: rgba(20, 20, 35, 0.8);
  }
}
