/* === 苍澜情武 · 墨韵绯色主题 CSS === */

/* 容器与基础变量 */
w {
  --ink: #1a0e14;
  --paper: #f5e6d3;
  --red: #c8324b;
  --pink: #e88ba8;
  --gold: #d4a24c;
  --jade: #8ab89a;
  --hotpink: #ffd6e0;
  --border: #4a2c35;
  display: block;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  padding: 0;
  margin: 0;
  position: relative;
}

w::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

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

/* 思维链面板 */
details.tc {
  background: linear-gradient(135deg, #2b1520 0%, #1a0e14 100%);
  border: 2px solid var(--red);
  border-radius: 6px;
  margin: 0 0 12px 0;
  padding: 0;
  box-shadow: 0 4px 12px rgba(200, 50, 75, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

details.tc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200'%3E%3Cpath d='M0,100 Q100,50 200,100 T400,100' stroke='%23c8324b' stroke-width='0.5' fill='none' opacity='0.1'/%3E%3Cpath d='M0,120 Q100,80 200,120 T400,120' stroke='%23e88ba8' stroke-width='0.3' fill='none' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

details.tc summary {
  padding: 10px 12px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--red) 0%, #a02838 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  position: relative;
  user-select: none;
  transition: background 0.2s;
}

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

details.tc summary::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: radial-gradient(circle, var(--red) 40%, transparent 70%);
  border: 2px solid var(--red);
  border-radius: 50%;
  opacity: 0.7;
}

details.tc summary::after {
  content: '▼';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  transition: transform 0.3s;
}

details.tc[open] summary::after {
  transform: translateY(-50%) rotate(180deg);
}

details.tc summary:hover {
  background: linear-gradient(90deg, #d63d56 0%, #b02f42 100%);
}

.tc-body {
  padding: 12px;
  background: rgba(42, 21, 32, 0.6);
  border-top: 1px solid rgba(200, 50, 75, 0.3);
}

.tc-body b {
  display: block;
  color: var(--gold);
  font-size: 13px;
  margin: 10px 0 4px 0;
  font-weight: 600;
}

.tc-body b:first-child {
  margin-top: 0;
}

.tc-body p {
  margin: 4px 0 0 0;
  color: var(--paper);
  font-size: 13px;
  line-height: 1.6;
}

/* 叙事正文 */
article.narr {
  background: linear-gradient(to bottom, rgba(26, 14, 20, 0.8), rgba(26, 14, 20, 0.95));
  border-left: 3px solid var(--pink);
  padding: 14px;
  margin: 0 0 12px 0;
  border-radius: 4px;
  color: var(--hotpink);
  font-size: 14px;
  line-height: 1.8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

article.narr p {
  margin: 0 0 12px 0;
  text-indent: 2em;
}

article.narr p:last-child {
  margin-bottom: 0;
}

/* 时间卡片 */
.tcard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  background: linear-gradient(135deg, #2b1029 0%, #1a1625 100%);
  border: 1px solid #7c3a5b;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 10px 0;
  color: var(--hotpink);
  box-shadow: 0 2px 6px rgba(124, 58, 91, 0.3);
}

.tl {
  font-size: 13px;
  color: #ff99cc;
}

.tm {
  font-size: 16px;
  font-weight: 700;
  color: #ff66a3;
  text-align: center;
  padding: 0 8px;
  border-left: 1px solid rgba(255, 153, 204, 0.3);
  border-right: 1px solid rgba(255, 153, 204, 0.3);
}

.tr {
  font-size: 13px;
  text-align: right;
}

/* 通用折叠面板 */
details {
  background: #231b26;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 0 10px 0;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s;
}

details:hover {
  box-shadow: 0 3px 8px rgba(200, 50, 75, 0.2);
}

details summary {
  padding: 9px 11px;
  cursor: pointer;
  background: #4a2c40;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  border-radius: 6px 6px 0 0;
  user-select: none;
  position: relative;
  transition: background 0.2s;
}

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

details summary::before {
  content: '◆';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: var(--red);
}

details summary::after {
  content: '▾';
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  transition: transform 0.25s;
  opacity: 0.8;
}

details[open] summary::after {
  transform: translateY(-50%) rotate(180deg);
}

details summary:hover {
  background: #5a3550;
}

details > div {
  padding: 12px;
}

/* 记忆区 */
details.mem summary {
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
}

details.mem summary:hover {
  background: linear-gradient(90deg, #5fbdff 0%, #1ffffe 100%);
}

details.mem i {
  display: block;
  font-size: 12px;
  color: #8ab89a;
  margin-bottom: 8px;
  font-style: italic;
}

details.mem b {
  display: block;
  color: var(--gold);
  font-size: 13px;
  margin: 10px 0 4px 0;
}

details.mem b:first-of-type {
  margin-top: 0;
}

details.mem p {
  margin: 4px 0 0 0;
  color: var(--paper);
  font-size: 13px;
  line-height: 1.6;
}

details.mem em {
  color: var(--pink);
  font-weight: 600;
  font-style: normal;
}

/* 心声面板 */
details.voice summary {
  background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
}

details.voice summary:hover {
  background: linear-gradient(90deg, #f5a3ff 0%, #ff6a7e 100%);
}

details.voice > div {
  background: rgba(240, 147, 251, 0.08);
}

details.voice p {
  margin: 0 0 8px 0;
  color: var(--hotpink);
  font-size: 13px;
}

details.voice p:last-child {
  margin-bottom: 0;
}

details.voice em {
  color: var(--pink);
  font-weight: 600;
  font-style: normal;
}

/* 排行榜 */
details.rank summary {
  background: linear-gradient(90deg, #ffa751 0%, #ffe259 100%);
  color: #2b1520;
}

details.rank summary:hover {
  background: linear-gradient(90deg, #ffb761 0%, #fff269 100%);
}

.rank-g {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.rank-g span {
  font-size: 13px;
  color: var(--paper);
  padding: 6px;
  background: rgba(212, 162, 76, 0.1);
  border-left: 2px solid var(--gold);
  border-radius: 3px;
}

/* 主角面板 */
details.pc summary {
  background: linear-gradient(90deg, #ff4d94 0%, #c8324b 100%);
}

details.pc summary:hover {
  background: linear-gradient(90deg, #ff5da4 0%, #d8425b 100%);
}

.pc-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  color: var(--hotpink);
  line-height: 1.7;
}

.pc-body span {
  font-size: 13px;
}

.pc-body .w2 {
  grid-column: span 2;
}

.pc-body .hot {
  color: #ff66a3;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pc-body b {
  color: var(--pink);
}

/* 女性NPC面板 */
details.fnpc summary {
  background: linear-gradient(90deg, #d299c2 0%, #b87fa0 100%);
}

details.fnpc summary:hover {
  background: linear-gradient(90deg, #e2a9d2 0%, #c88fb0 100%);
}

.fnpc-body {
  color: #ffe6f2;
  line-height: 1.7;
}

.fnpc-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #d299c2;
  padding-bottom: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}

.fnpc-top .hot {
  color: #ff4d94;
  font-weight: 600;
  animation: pulse 2s ease-in-out infinite;
}

.fnpc-mid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.fnpc-desc {
  margin: 8px 0;
  color: #ff99cc;
  font-size: 13px;
  line-height: 1.6;
}

.fnpc-desc b {
  color: var(--pink);
}

.fnpc-inner {
  margin-top: 8px;
  padding: 8px;
  background: rgba(210, 153, 194, 0.15);
  border-left: 3px solid var(--pink);
  border-radius: 3px;
  font-style: italic;
  color: #f2a6cb;
  font-size: 13px;
}

/* 男性NPC面板 */
details.mnpc summary {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

details.mnpc summary:hover {
  background: linear-gradient(90deg, #768efa 0%, #865bb2 100%);
}

.mnpc-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  color: #d4d9f5;
  font-size: 13px;
  line-height: 1.7;
}

.mnpc-body .w2 {
  grid-column: span 2;
}

.mnpc-body b {
  color: #a8b8ff;
}

/* 行动选择区 */
.act {
  background: rgba(255, 105, 180, 0.08);
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  margin: 10px 0 0 0;
  border: 1px solid rgba(255, 102, 163, 0.3);
}

.act-t {
  font-size: 15px;
  color: #ff66a3;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 0 8px rgba(255, 102, 163, 0.4);
}

.act-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.act-btns button {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  background: linear-gradient(135deg, #4a2c40 0%, #2b1520 100%);
  color: #fff;
  border: 1px solid #ff66a3;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.act-btns button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--red) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.act-btns button:hover {
  background: linear-gradient(135deg, #5a3550 0%, #3b1f30 100%);
  border-color: #ff99cc;
  box-shadow: 0 0 12px rgba(255, 102, 163, 0.5);
  transform: translateY(-1px);
}

.act-btns button:hover::before {
  opacity: 0.2;
}

.act-btns button:active {
  transform: translateY(0);
}

/* 用户消息气泡同步（平台适配） */
/* 针对常见AI聊天平台的用户消息容器 */
.user-message,
.message-user,
[class*="user"][class*="message"],
[class*="message"][class*="user"] {
  background: linear-gradient(135deg, #2b1520 0%, #1a0e14 100%) !important;
  border: 1px solid var(--border) !important;
  color: var(--paper) !important;
  border-radius: 6px !important;
  padding: 10px 12px !important;
  box-shadow: 0 2px 6px rgba(200, 50, 75, 0.2) !important;
}

/* 针对Markdown渲染区域的优化 */
w p, w li, w h1, w h2, w h3, w h4, w h5, w h6 {
  color: inherit;
}

w strong {
  color: var(--pink);
  font-weight: 600;
}

w em {
  color: var(--gold);
  font-style: italic;
}

w a {
  color: var(--jade);
  text-decoration: underline;
  transition: color 0.2s;
}

w a:hover {
  color: var(--pink);
}

/* 移动端响应 */
@media (max-width: 600px) {
  .rank-g {
    grid-template-columns: 1fr;
  }
  
  .pc-body,
  .fnpc-mid,
  .mnpc-body {
    grid-template-columns: 1fr;
  }
  
  .tcard {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .tm {
    border: none;
    border-top: 1px solid rgba(255, 153, 204, 0.3);
    border-bottom: 1px solid rgba(255, 153, 204, 0.3);
    padding: 4px 0;
  }
  
  .tr {
    text-align: left;
  }
  
  .act-btns {
    flex-direction: column;
  }
  
  .act-btns button {
    width: 100%;
  }
}