/* ============================================
   场景小游戏：NPC 触发点 + Modal + 三种玩法
   ============================================ */

/* ===== NPC 触发点（头顶冒"?"） ===== */
.npc-trigger {
  position: absolute;
  z-index: 35;
  width: 56px;
  height: 64px;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  animation: npcAppear 0.8s 1.5s forwards;
}

@keyframes npcAppear {
  from { opacity: 0; transform: translate(-50%, -90%); }
  to   { opacity: 1; transform: translate(-50%, -100%); }
}

.npc-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    #fff8e0 0%,
    #f0d98a 45%,
    #c9a96e 100%);
  border: 1.5px solid #fff8e0;
  box-shadow:
    0 0 0 1.5px rgba(184, 145, 90, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(232, 184, 94, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-kai);
  font-size: 22px;
  font-weight: 800;
  color: var(--c-seal);
  animation: npcBob 2.4s ease-in-out infinite;
  position: relative;
  user-select: none;
}

/* 气泡尾巴指向 NPC */
.npc-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #f0d98a;
}

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

/* 通关后：换成印章 */
.npc-trigger.done .npc-bubble {
  background: var(--c-seal);
  color: #f7ecd2;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  border-radius: 3px;
  border-color: rgba(255, 240, 200, 0.7);
  animation: none;
  box-shadow:
    0 0 0 1.5px rgba(255, 240, 200, 0.6),
    1px 2px 4px rgba(0, 0, 0, 0.25);
  transform: rotate(-6deg);
}

.npc-trigger.done .npc-bubble::after {
  border-top-color: var(--c-seal);
}

.npc-trigger:hover .npc-bubble {
  filter: brightness(1.15);
  box-shadow:
    0 0 0 1.5px rgba(184, 145, 90, 0.7),
    0 6px 14px rgba(0, 0, 0, 0.4),
    0 0 26px rgba(232, 184, 94, 0.85);
}

/* ===== 游戏 Modal 公共样式 ===== */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}

.game-modal.open {
  display: flex;
  animation: gameModalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gameModalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 6, 0.72);
  backdrop-filter: blur(6px);
}

.game-card {
  position: relative;
  width: min(880px, 92vw);
  height: min(560px, 86vh);
  background:
    repeating-linear-gradient(45deg,
      transparent 0 3px,
      rgba(160, 120, 70, 0.045) 3px 4px),
    linear-gradient(135deg, #f3e9d0 0%, #ecdfc0 50%, #e3d4b0 100%);
  border: 1.5px solid var(--c-gold);
  box-shadow:
    inset 0 0 0 1px rgba(245, 235, 215, 0.7),
    0 14px 36px rgba(0, 0, 0, 0.5);
  padding: 28px 36px 26px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--c-gold);
  background: rgba(245, 235, 215, 0.85);
  color: var(--c-ink);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 5;
  font-family: serif;
  line-height: 1;
}

.game-close:hover {
  background: var(--c-gold-light);
  color: var(--c-paper);
  transform: rotate(90deg);
}

.game-header {
  text-align: center;
  margin-bottom: 14px;
  padding: 0 50px;
}

.game-title {
  font-family: var(--font-kai);
  font-size: 24px;
  letter-spacing: 10px;
  color: var(--c-ink);
  font-weight: 600;
  padding-left: 10px;
}

.game-subtitle {
  font-family: var(--font-kai);
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--c-ink-light);
  margin-top: 4px;
}

.game-stage {
  flex: 1;
  position: relative;
  border: 1px solid rgba(184, 145, 90, 0.35);
  background: rgba(245, 235, 215, 0.45);
  overflow: hidden;
}

.game-hint {
  text-align: center;
  font-family: var(--font-kai);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--c-ink-light);
  margin-top: 10px;
  min-height: 18px;
}

/* 通用：游戏结果遮罩 */
.game-result {
  position: absolute;
  inset: 0;
  background: rgba(245, 235, 215, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
  animation: fadeIn 0.5s ease;
  text-align: center;
  padding: 0 30px;
}

.game-result.show { display: flex; }

.game-result-title {
  font-family: var(--font-kai);
  font-size: 26px;
  letter-spacing: 10px;
  color: var(--c-ink);
  font-weight: 600;
  padding-left: 10px;
}

.game-result-quote {
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 4px;
  line-height: 2;
  color: var(--c-ink-light);
  max-width: 560px;
}

.game-result-seal {
  width: 54px;
  height: 54px;
  background: var(--c-seal);
  color: #f7ecd2;
  font-family: var(--font-kai);
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.25);
  transform: rotate(-6deg);
  margin-top: 4px;
}

.game-result-actions {
  margin-top: 14px;
  display: flex;
  gap: 14px;
}

.game-btn {
  background: rgba(245, 235, 215, 0.92);
  border: 1.5px solid var(--c-gold);
  padding: 9px 26px;
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--c-ink);
  cursor: pointer;
  transition: all 0.3s;
}

.game-btn:hover {
  background: var(--c-paper-light);
  border-color: var(--c-gold-light);
  box-shadow: 0 0 14px rgba(201, 169, 110, 0.55);
}

/* ============================================
   游戏一 · 鲲化为鹏（北冥）
   ============================================ */
.kun-stage {
  background:
    radial-gradient(ellipse at 50% 110%, rgba(60, 80, 100, 0.18) 0%, transparent 70%),
    linear-gradient(180deg, #e8dec0 0%, #d8c8a0 60%, #b09870 100%);
}

.kun-water {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(180deg,
    rgba(60, 80, 100, 0.05) 0%,
    rgba(40, 60, 90, 0.18) 100%);
  overflow: hidden;
}

.kun-water::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(ellipse 240px 6px at 50% 50%, rgba(255,255,255,0.18) 0%, transparent 70%);
  background-size: 320px 24px;
  background-repeat: repeat;
  animation: waterFlow 18s linear infinite;
  opacity: 0.6;
}

.kun-fish {
  position: absolute;
  left: 50%;
  top: 70%;
  width: 90px;
  height: 36px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: top 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.4s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.kun-fish svg { width: 100%; height: 100%; display: block; }

.kun-trail {
  position: absolute;
  pointer-events: none;
  width: 50px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.6) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: kunTrail 1s ease-out forwards;
  mix-blend-mode: screen;
}

@keyframes kunTrail {
  0%   { opacity: 0.7; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(2); }
}

.kun-meter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 6px;
  background: rgba(160, 120, 70, 0.18);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(184, 145, 90, 0.4);
}

.kun-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--c-gold) 0%, var(--c-gold-light) 100%);
  box-shadow: 0 0 8px rgba(232, 184, 94, 0.7);
  transition: width 0.18s ease;
}

.kun-meter-label {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-kai);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--c-ink-light);
}

/* 鹏 — 集气满之后从水中冲出 */
.kun-peng {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 220px;
  height: 110px;
  transform: translate(-50%, 60%);
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.kun-peng svg { width: 100%; height: 100%; display: block; }

.kun-stage.transformed .kun-water { opacity: 0.4; }
.kun-stage.transformed .kun-fish  { opacity: 0; }
.kun-stage.transformed .kun-peng  { animation: pengRise 2.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes pengRise {
  0%   { opacity: 0; transform: translate(-50%, 30%) scale(0.4); }
  20%  { opacity: 1; transform: translate(-50%, -10%) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -90%) scale(1.1); }
}

.kun-splash {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: kunSplash 1.4s ease-out forwards;
  mix-blend-mode: screen;
}

@keyframes kunSplash {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0.9; border-width: 3px; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; border-width: 0.5px; }
}

/* ============================================
   游戏二 · 知鱼之乐（濠梁）
   ============================================ */
.zhi-stage {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(245, 235, 215, 0.4) 0%, transparent 60%),
    linear-gradient(180deg, #efe2c4 0%, #d8c8a0 100%);
  padding: 26px 30px;
}

.zhi-bridge {
  position: relative;
  flex: 0 0 86px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding-bottom: 6px;
  border-bottom: 1.5px solid rgba(160, 120, 70, 0.35);
  margin-bottom: 14px;
}

.zhi-figure {
  text-align: center;
}

.zhi-figure-name {
  font-family: var(--font-kai);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--c-ink);
  margin-top: 4px;
  padding-left: 3px;
}

.zhi-figure-portrait {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-paper-light);
  border: 1.5px solid var(--c-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-kai);
  font-size: 22px;
  color: var(--c-ink);
  font-weight: 600;
  margin: 0 auto;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.18);
}

.zhi-figure.active .zhi-figure-portrait {
  border-color: var(--c-gold-light);
  box-shadow: 0 0 14px rgba(232, 184, 94, 0.7);
  background: rgba(255, 245, 220, 1);
}

.zhi-river {
  position: absolute;
  inset: auto 0 -8px 0;
  height: 14px;
  background: repeating-linear-gradient(90deg,
    transparent 0 8px,
    rgba(60, 80, 100, 0.15) 8px 12px);
  border-radius: 50%;
}

.zhi-dialogue {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 4px 6px;
}

.zhi-line {
  max-width: 78%;
  padding: 10px 16px;
  border: 1px solid rgba(184, 145, 90, 0.4);
  background: rgba(255, 248, 230, 0.85);
  font-family: var(--font-kai);
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 2px;
  color: var(--c-ink);
  border-radius: 2px;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0;
  animation: zhiLineIn 0.5s ease forwards;
}

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

.zhi-line.huizi   { align-self: flex-start; border-left: 3px solid #6a5b3a; }
.zhi-line.zhuangzi { align-self: flex-end;  border-right: 3px solid var(--c-seal); background: rgba(255, 240, 215, 0.92); }

.zhi-line .zhi-speaker {
  display: block;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--c-ink-light);
  margin-bottom: 4px;
}

.zhi-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.zhi-choice {
  align-self: flex-end;
  max-width: 78%;
  padding: 9px 16px;
  background: rgba(245, 235, 215, 0.65);
  border: 1px dashed rgba(184, 145, 90, 0.55);
  font-family: var(--font-kai);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 2px;
  color: var(--c-ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s;
}

.zhi-choice:hover {
  background: rgba(255, 248, 220, 0.95);
  border-color: var(--c-gold-light);
  border-style: solid;
  box-shadow: 0 0 10px rgba(201, 169, 110, 0.4);
  transform: translateX(-2px);
}

/* ============================================
   游戏三 · 探骊得珠（颖水）
   ============================================ */
.tanli-stage {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(60, 80, 100, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, #2a3540 0%, #14202c 60%, #0a141e 100%);
}

.tanli-depth {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18%;
  background: linear-gradient(180deg, rgba(60, 80, 100, 0.35) 0%, transparent 100%);
  pointer-events: none;
}

.tanli-depth::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(ellipse 240px 4px at 50% 50%, rgba(255,255,255,0.12) 0%, transparent 70%);
  background-size: 280px 18px;
  background-repeat: repeat;
  animation: waterFlow 22s linear infinite;
}

/* 骊龙 — 居中盘踞 */
.tanli-dragon {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 360px;
  height: 220px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6));
  transition: filter 0.5s, transform 0.5s;
}

.tanli-dragon svg { width: 100%; height: 100%; display: block; }

.tanli-eye {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe680 0%, #c9842a 60%, transparent 100%);
  box-shadow: 0 0 12px rgba(232, 184, 94, 0.8);
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

/* 眼睛挂在 dragon 内部，按 SVG viewBox 比例 (360x220) 定位 */
.tanli-eye.left  { left: 41%; top: 41%; }
.tanli-eye.right { left: 53%; top: 41%; }

.tanli-stage.awake .tanli-eye { opacity: 1; }
.tanli-stage.roar .tanli-eye  {
  background: radial-gradient(circle, #ff8a5a 0%, #b8453e 60%, transparent 100%);
  box-shadow: 0 0 22px rgba(184, 69, 62, 0.95);
}

.tanli-stage.roar .tanli-dragon {
  filter: drop-shadow(0 6px 24px rgba(184, 69, 62, 0.9)) brightness(1.15);
  animation: roarShake 0.4s ease-in-out 3;
}

@keyframes roarShake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0); }
  25%      { transform: translate(-52%, -50%) rotate(-1deg); }
  75%      { transform: translate(-48%, -50%) rotate(1deg); }
}

/* 骊珠 */
.tanli-pearl {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    #fff8e0 0%,
    #f0d98a 35%,
    #c9a96e 80%);
  box-shadow:
    0 0 14px rgba(255, 240, 200, 0.9),
    0 0 28px rgba(232, 184, 94, 0.6),
    inset 0 -4px 6px rgba(160, 120, 70, 0.4);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
  animation: pearlBreatheTanli 3s ease-in-out infinite;
}

@keyframes pearlBreatheTanli {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.12); }
}

.tanli-pearl:hover {
  filter: brightness(1.2);
}

/* 节奏指示条 — 显示骊龙呼吸状态 */
.tanli-rhythm {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 320px;
  height: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.tanli-rhythm-bar {
  width: 100%;
  height: 6px;
  background: rgba(245, 235, 215, 0.18);
  border: 1px solid rgba(245, 235, 215, 0.35);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.tanli-rhythm-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg,
    rgba(140, 200, 140, 0.7) 0%,
    rgba(232, 184, 94, 0.85) 60%,
    rgba(184, 69, 62, 0.95) 100%);
  transition: width 0.1s linear;
}

.tanli-rhythm-label {
  font-family: var(--font-kai);
  font-size: 11px;
  letter-spacing: 3px;
  color: rgba(245, 235, 215, 0.85);
}

.tanli-life {
  position: absolute;
  top: 14px;
  left: 18px;
  display: flex;
  gap: 6px;
}

.tanli-life-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-seal);
  box-shadow: 0 0 6px rgba(184, 69, 62, 0.6);
  border: 1px solid rgba(255, 240, 215, 0.6);
}

.tanli-life-dot.lost {
  background: transparent;
  box-shadow: none;
}

/* 移动端：缩比例 */
@media (max-width: 768px) {
  .game-card { width: 96vw; height: 88vh; padding: 22px 18px; }
  .game-title { font-size: 18px; letter-spacing: 6px; }
  .kun-meter { width: 60%; }
  .tanli-dragon { width: 260px; height: 160px; }
  .tanli-rhythm { width: 80%; }
  .zhi-figure-portrait { width: 44px; height: 44px; font-size: 18px; }
}

