/* ═══════════════════════════════════════
   🌿 森系木质 · 内置CSS
   所有选择器限定在 card 标签下
   ═══════════════════════════════════════ */

/* ── 基础容器 ── */
card {
  display: block;
  max-width: 720px;
  margin: 12px auto;
  padding: 0;
  font-family: "Noto Serif SC", "Source Han Serif CN", "Georgia", serif;
  font-size: clamp(14px, 2.8vw, 16.5px);
  line-height: 1.85;
  color: #3b2f2f;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(139,90,43,0.02) 3px,
      rgba(139,90,43,0.02) 4px
    ),
    linear-gradient(135deg, #f5ead6 0%, #f0e0c6 30%, #ece3d4 70%, #f5ead6 100%);
  border: 1px solid rgba(139,90,43,0.15);
  border-radius: 6px;
  box-shadow:
    0 2px 12px rgba(101,67,33,0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);
  overflow: hidden;
  position: relative;
}

card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

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

/* ── 顶部环境栏 ── */
env {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  padding: 10px 16px;
  font-size: clamp(11.5px, 2.4vw, 13px);
  color: #6b5744;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, rgba(139,90,43,0.06) 0%, transparent 100%);
  border-bottom: 1px solid rgba(139,90,43,0.1);
}

/* ── 正文区 ── */
text {
  display: block;
  padding: 20px clamp(16px, 4vw, 28px);
}

card text p {
  margin: 0 0 0.9em 0;
  text-indent: 2em;
  text-align: justify;
  word-break: break-word;
  color: #3b2f2f;
}

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

/* 周慈遥对话 */
card text p.zcy {
  text-indent: 0;
  padding: 8px 14px;
  margin: 0.7em 0;
  background: linear-gradient(90deg, rgba(167,137,107,0.08) 0%, transparent 100%);
  border-left: 2.5px solid #a78b6b;
  border-radius: 0 4px 4px 0;
  color: #5a3e2b;
  font-style: italic;
  position: relative;
}

card text p.zcy::before {
  content: "🍃";
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-style: normal;
  opacity: 0.6;
}

/* NPC对话 */
card text p.d {
  text-indent: 0;
  padding: 6px 14px;
  margin: 0.7em 0;
  border-left: 2px dashed rgba(139,90,43,0.25);
  color: #6b5744;
}

/* ── 行动选项区 ── */
actions {
  display: block;
  padding: 14px clamp(16px, 4vw, 28px) 16px;
  border-top: 1px dashed rgba(139,90,43,0.15);
}

card actions p {
  margin: 0;
  padding: 10px 14px;
  font-size: clamp(13px, 2.6vw, 14.5px);
  color: #5a3e2b;
  background: rgba(167,137,107,0.05);
  border: 1px solid rgba(139,90,43,0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

card actions p + p {
  margin-top: 6px;
}

card actions p:hover {
  background: rgba(167,137,107,0.12);
  border-color: rgba(139,90,43,0.25);
  transform: translateX(4px);
  box-shadow: 0 1px 4px rgba(101,67,33,0.08);
}

card actions p:active {
  transform: translateX(2px);
  background: rgba(167,137,107,0.18);
}

/* ── 折叠块通用样式 ── */
card > details {
  margin: 0;
  border-top: 1px solid rgba(139,90,43,0.1);
}

card > details > summary {
  padding: 11px clamp(16px, 4vw, 28px);
  font-size: clamp(13px, 2.6vw, 14.5px);
  font-weight: 700;
  color: #5a3e2b;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.2s ease;
  background: linear-gradient(90deg, rgba(139,90,43,0.03) 0%, transparent 60%);
}

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

card > details > summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #8b6b4a;
  border-bottom: 1.5px solid #8b6b4a;
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  margin-left: auto;
  flex-shrink: 0;
}

card > details[open] > summary::after {
  transform: rotate(45deg);
}

card > details > summary:hover {
  background: rgba(139,90,43,0.06);
}

card > details > summary:active {
  background: rgba(139,90,43,0.1);
}

card > details > p,
card > details > div {
  padding: 0 clamp(16px, 4vw, 28px) 12px;
  font-size: clamp(12.5px, 2.5vw, 14px);
  color: #5a4637;
  line-height: 1.75;
}

card > details > p {
  margin: 0 0 4px 0;
  text-indent: 0;
}

card > details > p > b {
  color: #6b4f3a;
  font-weight: 600;
  white-space: nowrap;
}

/* ── 记忆区（嵌套折叠块） ── */
card details details {
  margin: 0 clamp(12px, 3vw, 20px) 6px;
  border: 1px solid rgba(139,90,43,0.08);
  border-radius: 5px;
  background: rgba(245,234,214,0.4);
  overflow: hidden;
}

card details details:first-of-type {
  margin-top: 4px;
}

card details details > summary {
  padding: 8px 12px;
  font-size: clamp(12px, 2.4vw, 13.5px);
  font-weight: 600;
  color: #6b5744;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.2s ease;
}

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

card details details > summary::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid #9c8b7a;
  border-bottom: 1.5px solid #9c8b7a;
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  margin-left: auto;
  flex-shrink: 0;
}

card details details[open] > summary::after {
  transform: rotate(45deg);
}

card details details > summary:hover {
  background: rgba(139,90,43,0.05);
}

card details details > p {
  padding: 0 12px 6px;
  margin: 0 0 2px 0;
  font-size: clamp(11.5px, 2.3vw, 13px);
  color: #6b5744;
  line-height: 1.7;
  text-indent: 0;
  border-bottom: 1px dotted rgba(139,90,43,0.06);
}

card details details > p:last-child {
  border-bottom: none;
  padding-bottom: 8px;
}

/* ── 心声折叠块特殊样式 ── */
card > details:first-of-type {
  background: linear-gradient(90deg, rgba(183,159,131,0.05) 0%, transparent 100%);
}

card > details:first-of-type > p {
  font-style: italic;
  color: #7a6655;
  padding-left: clamp(20px, 5vw, 36px);
  position: relative;
}

card > details:first-of-type > p::before {
  content: "❝";
  position: absolute;
  left: clamp(6px, 2vw, 16px);
  top: -2px;
  font-size: 18px;
  color: rgba(139,90,43,0.2);
  font-style: normal;
}

/* ── 装饰性元素 ── */

/* 顶部藤蔓装饰线 */
card::after {
  content: "─ ✾ ─";
  display: block;
  text-align: center;
  padding: 8px 0 0;
  font-size: 11px;
  color: rgba(139,90,43,0.15);
  letter-spacing: 6px;
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
}

card > *:last-child {
  padding-bottom: 24px;
}

/* 正文区与状态区之间的分隔装饰 */
text + actions::before,
text + details::before {
  content: "· · ·";
  display: block;
  text-align: center;
  padding: 4px 0 0;
  font-size: 12px;
  color: rgba(139,90,43,0.2);
  letter-spacing: 8px;
}

/* ── 滚动条美化（PC端） ── */
card ::-webkit-scrollbar {
  width: 4px;
}

card ::-webkit-scrollbar-track {
  background: transparent;
}

card ::-webkit-scrollbar-thumb {
  background: rgba(139,90,43,0.15);
  border-radius: 4px;
}

card ::-webkit-scrollbar-thumb:hover {
  background: rgba(139,90,43,0.3);
}

/* ═══════════════════════════════════════
   📱 移动端响应式
   ═══════════════════════════════════════ */

@media screen and (max-width: 480px) {
  card {
    margin: 6px 4px;
    border-radius: 4px;
  }

  env {
    gap: 2px 10px;
    padding: 8px 12px;
  }

  text {
    padding: 16px 14px;
  }

  card text p.zcy {
    padding: 7px 12px;
  }

  card text p.zcy::before {
    display: none;
  }

  actions {
    padding: 12px 14px;
  }

  card actions p {
    padding: 10px 12px;
    font-size: clamp(13px, 3vw, 14px);
  }

  card > details > summary {
    padding: 10px 14px;
  }

  card details details {
    margin: 0 8px 5px;
  }

  card details details > summary {
    padding: 8px 10px;
  }

  card details details > p {
    padding: 0 10px 5px;
  }
}

@media screen and (max-width: 360px) {
  card {
    font-size: 14px;
    margin: 4px 2px;
  }

  env {
    font-size: 11px;
    padding: 6px 10px;
  }

  text {
    padding: 14px 12px;
  }
}

/* ═══════════════════════════════════════
   🖥️ 宽屏优化
   ═══════════════════════════════════════ */

@media screen and (min-width: 768px) {
  card {
    box-shadow:
      0 4px 20px rgba(101,67,33,0.1),
      inset 0 1px 0 rgba(255,255,255,0.6);
  }

  card actions p:hover {
    transform: translateX(6px);
    box-shadow: 0 2px 8px rgba(101,67,33,0.1);
  }
}

/* ═══════════════════════════════════════
   ✨ 动画
   ═══════════════════════════════════════ */

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

card {
  animation: cardFadeIn 0.4s ease-out;
}

card > details[open] > p,
card > details[open] > div,
card details details[open] > p {
  animation: cardFadeIn 0.25s ease-out;
}