/* ============================================================
   game.css —— 文字意识空间
   字块、词块、拼接界面、旁白、记忆弹层、结局
   ============================================================ */

#game {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ---------- 场上的字 / 词 ---------- */
#field {
  position: absolute;
  inset: 0;
  touch-action: none;
}

/* ========== token 重构：外层仅定位，内层承载视觉+抖动 ========== */
.token {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: opacity 0.4s ease;
  will-change: transform, opacity;
}

.token > .tk-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.4s ease, color 0.6s ease, border-color 0.4s ease,
              transform 0.16s ease-out;
  will-change: transform;
}

.token.char > .tk-inner {
  min-width: 56px;
  height: 56px;
  padding: 0 0.7rem;
  box-sizing: border-box;
  font-size: 1.5rem;
  color: #d8d8e0;
  border: 1px solid rgba(200,200,220,0.18);
  border-radius: 6px;
  background: rgba(16,16,22,0.92);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.token.char:hover > .tk-inner,
.token.char.selected > .tk-inner {
  color: #fff;
  border-color: rgba(184,155,94,0.9);
  box-shadow: 0 0 18px rgba(184,155,94,0.35);
}

.token.word > .tk-inner {
  min-width: 116px;
  height: 62px;
  padding: 0 1.1rem;
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  border-radius: 8px;
  background: rgba(24,22,18,0.94);
  border: 1px solid rgba(184,155,94,0.55);
  color: #e8dcbf;
  box-shadow: 0 0 16px rgba(184,155,94,0.12);
}

.token.word.nature-light > .tk-inner  { color:#f2e6bf; border-color:rgba(220,190,110,0.9); box-shadow:0 0 34px rgba(220,190,110,0.4); }
.token.word.nature-void > .tk-inner   { color:#c9b8c9; border-color:rgba(120,40,40,0.9); box-shadow:0 0 34px rgba(120,20,20,0.45); }
.token.word.nature-memory > .tk-inner { color:#bcd0e0; border-color:rgba(110,150,180,0.8); }
.token.word.nature-emotion > .tk-inner{ color:#e0b8c0; border-color:rgba(180,90,110,0.8); }
.token.word.nature-ash > .tk-inner    { color:#b8b0a4; border-color:rgba(140,130,120,0.7); }
.token.word.nature-time > .tk-inner   { color:#c8c8b0; border-color:rgba(150,150,120,0.7); }
.token.word.nature-life > .tk-inner   { color:#c0e0c0; border-color:rgba(90,150,90,0.8); }
.token.word.nature-self > .tk-inner   { color:#d0c0e0; border-color:rgba(140,110,170,0.8); }

@keyframes token-in {
  0%   { opacity:0; transform:translate(-50%,-50%) scale(0.6); }
  100% { opacity:1; transform:translate(-50%,-50%) scale(1); }
}
.token.spawn { animation: token-in 0.5s ease both; }

@keyframes token-out {
  0%   { opacity:1; transform:translate(-50%,-50%) scale(1); }
  100% { opacity:0; transform:translate(-50%,-50%) scale(1.4); filter:blur(6px); }
}
.token.dissolve { animation: token-out 0.5s ease both; }

/* ---------- 顶部: 幕名 + 目标 ---------- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 0.9rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: #7d7d88;
  z-index: 500;
  pointer-events: none;
}

#hud .act-name { color:#b89b5e; }
#hud .goal { color:#8f8f9a; }
#hud .goal .hint-char { color:#cfcfd6; }

/* ---------- 旁白 ---------- */
#narration {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 2.2rem 1.6rem 3.4rem;
  background: linear-gradient(to top, rgba(4,4,6,0.96) 40%, rgba(4,4,6,0));
  z-index: 600;
  pointer-events: none;
  text-align: center;
}

#narration .tap {
  margin-top: 1.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: #6a6a76;
  animation: breathe 2.6s infinite;
}

/* ---------- 记忆弹层 ---------- */
#memory {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2,2,4,0.92);
  z-index: 800;
  padding: 2rem;
}

#memory.open { display: flex; }

#memory .inner {
  max-width: 560px;
  text-align: center;
  animation: mem-in 0.6s ease both;
}

#memory .word-shown {
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  letter-spacing: 0.3em;
  color: #e8dcbf;
  margin-bottom: 2rem;
  text-shadow: 0 0 30px rgba(184,155,94,0.4);
}

#memory .mem-line {
  font-size: clamp(0.95rem, 4.1vw, 1.15rem);
  color: #cfcfd6;
  line-height: 2.1;
  margin-bottom: 1.1rem;
}

#memory .secret-line {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(184,155,94,0.25);
  color: #9a7f4e;
  font-size: clamp(0.85rem, 3.7vw, 1rem);
  line-height: 2;
  letter-spacing: 0.08em;
}

#memory .close-hint {
  margin-top: 2.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: #5c5c66;
  animation: breathe 2.6s infinite;
}

/* ---------- 结局 ---------- */
#ending {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #020203;
  z-index: 900;
  padding: 8vh 2rem 4rem;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#ending.open { display: flex; }

#ending .end-title {
  font-size: clamp(1.5rem, 7vw, 2.4rem);
  letter-spacing: 0.35em;
  color: #b89b5e;
  margin-bottom: 3rem;
  opacity: 0;
  transition: opacity 2.2s ease;
}

#ending .end-title.show { opacity: 1; }

#ending .end-body p {
  font-size: clamp(1rem, 4.2vw, 1.2rem);
  color: #b8b8c0;
  line-height: 2.2;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.6s ease, transform 1.6s ease;
}

#ending .end-body p.show { opacity: 1; transform: translateY(0); }

#ending .restart {
  margin-top: 2.4rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  color: #e8dcbf;
  opacity: 0;
  transition: opacity 1s ease, box-shadow 0.4s ease, background 0.4s ease;
  cursor: pointer;
  border: 1px solid rgba(184,155,94,0.75);
  padding: 0.95rem 2.2rem;
  border-radius: 6px;
  background: rgba(184,155,94,0.1);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  animation: restPulse 2.4s infinite;
}

#ending .restart.show { opacity: 1; }

#ending .restart:active {
  background: rgba(184,155,94,0.3);
  box-shadow: 0 0 26px rgba(184,155,94,0.5);
}

@keyframes restPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(184,155,94,0.15); }
  50%      { box-shadow: 0 0 26px rgba(184,155,94,0.4); }
}

/* 终幕选择提示 */
#final-hint {
  position: fixed;
  left: 0; right: 0;
  bottom: 1.4rem;
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  color: #56565f;
  z-index: 610;
  pointer-events: none;
  display: none;
}

#final-hint.open { display: block; }


/* ============================================================
   响应式：小屏适配
   ============================================================ */
@media (max-width: 560px) {
  .token.char > .tk-inner {
    min-width: 50px; height: 50px; font-size: 1.35rem; padding: 0 0.6rem;
  }
  .token.word {
    min-width: 96px; height: 56px;
    font-size: 1.35rem; padding: 0 0.75rem;
    letter-spacing: 0.1em;
  }
  #hud { font-size: 0.7rem; padding: 0.7rem 0.9rem; }
  #narration { padding: 1.8rem 1.2rem 2.8rem; }
}

@media (max-width: 360px) {
  .token.char > .tk-inner { min-width: 44px; height: 44px; font-size: 1.2rem; padding: 0 0.5rem; }
  .token.word > .tk-inner { min-width: 88px; height: 50px; font-size: 1.2rem; }
}

/* 横屏时压缩垂直空间 */
@media (orientation: landscape) and (max-height: 520px) {
  .token.char > .tk-inner { min-width: 44px; height: 44px; font-size: 1.2rem; padding: 0 0.5rem; }
  .token.word > .tk-inner { height: 50px; font-size: 1.25rem; }
  #narration { padding: 1rem 1.2rem 1.6rem; }
}


/* 记忆弹层里的拆散按钮 */
.mem-split-btn {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.7rem 1.6rem;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: #e8dcbf;
  background: transparent;
  border: 1px solid rgba(184, 155, 94, 0.6);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.mem-split-btn:hover, .mem-split-btn:active {
  background: rgba(184, 155, 94, 0.2);
  box-shadow: 0 0 20px rgba(184, 155, 94, 0.35);
}


/* 自动存档提示 */
.save-toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%) translateY(12px);
  padding: 0.5rem 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: #b89b5e;
  background: rgba(10,10,14,0.92);
  border: 1px solid rgba(184,155,94,0.3);
  border-radius: 20px;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.save-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}



/* ============================================================
   全局功能按钮：存 / 返回主菜单
   永远在最上层, 不受任何光效、暗角、章节层影响
   ============================================================ */
#save-btn, #back-btn {
  position: fixed;
  z-index: 1300;
  width: 46px;
  height: 46px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  /* 不透明背景, 彻底隔离环境光 */
  background: #121218;
  transition: transform 0.15s ease, box-shadow 0.2s ease,
              color 0.2s ease, border-color 0.2s ease;
}

#save-btn {
  top: 0.8rem;
  right: 0.9rem;
  color: #e8dcbf;
  border: 1px solid rgba(184,155,94,0.7);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.8);
}
#save-btn:hover, #save-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,1);
  background: #1c1a12;
  transform: scale(1.08);
}
#save-btn.saved {
  color: #8fd0a0;
  border-color: rgba(120,200,140,0.9);
  font-size: 0.72rem;
}

#back-btn {
  top: 0.8rem;
  left: 0.9rem;
  color: #cfcfd6;
  border: 1px solid rgba(140,140,160,0.6);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.8);
  font-size: 1.2rem;
}
#back-btn:hover, #back-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,0.9);
  background: #1c1a12;
  transform: scale(1.08);
}

/* 菜单打开时隐藏这两个按钮 */
body.menu-open #save-btn,
body.menu-open #back-btn {
  display: none !important;
}

/* hud 的 goal 避让右上角存按钮 */
#hud .goal { margin-right: 3rem; }


/* ============================================================
   全局功能按钮：存 / 返回主菜单
   永远在最上层, 不受任何光效、暗角、章节层影响
   ============================================================ */
#save-btn, #back-btn {
  position: fixed;
  z-index: 1300;
  width: 46px;
  height: 46px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  /* 不透明背景, 彻底隔离环境光 */
  background: #121218;
  transition: transform 0.15s ease, box-shadow 0.2s ease,
              color 0.2s ease, border-color 0.2s ease;
}

#save-btn {
  top: 0.8rem;
  right: 0.9rem;
  color: #e8dcbf;
  border: 1px solid rgba(184,155,94,0.7);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.8);
}
#save-btn:hover, #save-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,1);
  background: #1c1a12;
  transform: scale(1.08);
}
#save-btn.saved {
  color: #8fd0a0;
  border-color: rgba(120,200,140,0.9);
  font-size: 0.72rem;
}

#back-btn {
  top: 0.8rem;
  left: 0.9rem;
  color: #cfcfd6;
  border: 1px solid rgba(140,140,160,0.6);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.8);
  font-size: 1.2rem;
}
#back-btn:hover, #back-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,0.9);
  background: #1c1a12;
  transform: scale(1.08);
}

/* 菜单打开时隐藏这两个按钮 */
body.menu-open #save-btn,
body.menu-open #back-btn {
  display: none !important;
}

/* hud 的 goal 避让右上角存按钮 */
#hud .goal { margin-right: 3rem; }

/* ============================================================
   全局功能按钮 存 / 菜单 —— 永远在最上层
   ============================================================ */
#save-btn, #back-btn {
  position: fixed;
  z-index: 1300 !important;
  top: 0.8rem;
  width: auto;
  min-width: 48px;
  height: 46px;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: #121218;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.7), 0 2px 12px rgba(0,0,0,0.85);
  transition: transform 0.15s ease, box-shadow 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
#save-btn {
  right: 0.9rem;
  color: #e8dcbf;
  border: 1px solid rgba(184,155,94,0.7);
}
#save-btn:hover, #save-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,1);
  background: #1c1a12;
  transform: scale(1.06);
}
#save-btn.saved {
  color: #8fd0a0;
  border-color: rgba(120,200,140,0.9);
}
#back-btn {
  left: 0.9rem;
  color: #cfcfd6;
  border: 1px solid rgba(140,140,160,0.6);
}
#back-btn:hover, #back-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,0.9);
  background: #1c1a12;
  transform: scale(1.06);
}
body.menu-open #save-btn,
body.menu-open #back-btn { display: none !important; }
#hud .goal { margin-right: 3.5rem; }

/* ============================================================
   磨砂玻璃效果 —— 所有游戏内按钮
   ============================================================ */
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {

  /* 存 / 菜单 */
  #save-btn, #back-btn {
    background: rgba(18, 18, 26, 0.62);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
    border-color: rgba(255, 255, 255, 0.12);
  }

  /* 方向键 */
  .c1-btn {
    background: rgba(22, 22, 30, 0.55);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    backdrop-filter: blur(12px) saturate(1.4);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .c1-btn:active {
    background: rgba(184, 155, 94, 0.35);
  }

  /* 主菜单按钮 */
  .menu-btn {
    background: rgba(20, 20, 28, 0.55);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .menu-btn:hover, .menu-btn:active {
    background: rgba(184, 155, 94, 0.16);
  }
  .menu-btn-primary {
    background: rgba(184, 155, 94, 0.1);
  }

  /* 清除 / 诊断按钮 */
  .menu-clear {
    background: rgba(30, 10, 10, 0.55);
    -webkit-backdrop-filter: blur(12px) saturate(1.3);
    backdrop-filter: blur(12px) saturate(1.3);
  }

  /* 结局按钮 */
  #ending .restart {
    background: rgba(184, 155, 94, 0.12);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
  }

  /* 拆散按钮 */
  .mem-split-btn {
    background: rgba(24, 22, 18, 0.55);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    backdrop-filter: blur(12px) saturate(1.4);
  }
}

/* 回退：浏览器不支持毛玻璃时, 用较实的背景 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #save-btn, #back-btn { background: #121218; }
  .c1-btn { background: rgba(22, 22, 30, 0.92); }
  .menu-btn { background: rgba(20, 20, 28, 0.92); }
}

/* ============================================================
   磨砂玻璃（末尾强制覆盖, 确保生效）
   ============================================================ */
#save-btn, #back-btn {
  background: rgba(20, 20, 30, 0.55) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.7) !important;
  backdrop-filter: blur(18px) saturate(1.7) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}
#save-btn:hover, #save-btn:active,
#back-btn:hover, #back-btn:active {
  background: rgba(184, 155, 94, 0.3) !important;
}
#save-btn.saved {
  background: rgba(30, 60, 40, 0.6) !important;
}

.c1-btn {
  background: rgba(22, 22, 32, 0.5) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.6) !important;
  backdrop-filter: blur(16px) saturate(1.6) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
.c1-btn:active {
  background: rgba(184, 155, 94, 0.45) !important;
}

.mem-split-btn {
  background: rgba(24, 22, 18, 0.5) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.6) !important;
  backdrop-filter: blur(16px) saturate(1.6) !important;
}

#ending .restart {
  background: rgba(184, 155, 94, 0.14) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.7) !important;
  backdrop-filter: blur(18px) saturate(1.7) !important;
}

/* 提高通透度: 背景更透 */
#save-btn, #back-btn {
  background: rgba(20, 20, 30, 0.32) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.9) !important;
  backdrop-filter: blur(22px) saturate(1.9) !important;
}
.c1-btn {
  background: rgba(22, 22, 32, 0.28) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.8) !important;
  backdrop-filter: blur(20px) saturate(1.8) !important;
}
.mem-split-btn {
  background: rgba(24, 22, 18, 0.3) !important;
}
#ending .restart {
  background: rgba(184, 155, 94, 0.1) !important;
}


/* ============================================================
   全局字符背景层
   ============================================================ */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#bg-layer .menu-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


/* HUD 下移, 避开顶部存/菜单按钮 */
#hud {
  padding: 4.6rem 1.2rem 0.8rem !important;
}
/* 去掉之前的 margin-right 避让(已不需要) */
#hud .goal { margin-right: 0 !important; }

/* 音效开关按钮(左下角) */
#sound-btn {
  position: fixed;
  z-index: 1300 !important;
  left: 0.9rem;
  bottom: 0.9rem;
  width: 42px;
  height: 42px;
  font-family: inherit;
  font-size: 1.1rem;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #cfcfd6;
  background: rgba(20,20,30,0.5);
  border: 1px solid rgba(255,255,255,0.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.7);
  backdrop-filter: blur(18px) saturate(1.7);
  transition: all 0.2s ease;
}
#sound-btn:hover, #sound-btn:active {
  color: #fff;
  border-color: rgba(184,155,94,0.8);
}
#sound-btn.muted {
  color: #5a5a66;
  border-color: rgba(120,120,140,0.3);
}
body.menu-open #sound-btn { display: none !important; }

/* ---------- 记忆弹层入场（不含位移，居中） ---------- */
@keyframes mem-in {
  0%   { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- 旁白（Narration 引擎通用样式，两容器共用） ---------- */
.narr-stack {
  position: relative;
  width: 100%;
  height: calc(4 * 2.3rem);
  pointer-events: none;
}
p.narr-line {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  margin: 0;
  opacity: 1;
  transform: translateY(0);
  transition: transform 0.7s cubic-bezier(.25,.6,.35,1), opacity 1s ease;
  will-change: transform, opacity;
}
.narr-char {
  display: inline-block;
  opacity: 1;
  animation: char-drop 0.42s cubic-bezier(.2,.7,.3,1.2) both;
}
.narr-char.settled { animation: none; }
.narr-char.dissolve-char { animation: char-dissolve 1.3s ease forwards; }
.narr-tap {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: #6a6a76;
  animation: breathe 2.6s infinite;
  text-align: center;
}

/* ---------- 从菜单进入游戏：淡入 ---------- */
@keyframes game-fade-in {
  0%   { opacity: 0; transform: translateY(10px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
body:not(.menu-open) #game {
  animation: game-fade-in 2.4s ease both;
}

/* ---------- 旁白期间隐藏右上角按钮 ---------- */
body.narrating #save-btn,
body.narrating #back-btn,
body.narrating #sound-btn {
}

/* 双保险：直接检测旁白容器状态（不依赖 JS 加类） */
body:has(#narration .narr-stack) #save-btn,
body:has(#narration .narr-stack) #back-btn,
body:has(#narration .narr-stack) #sound-btn,
body:has(.c1-narr.open) #save-btn,
body:has(.c1-narr.open) #back-btn,
body:has(.c1-narr.open) #sound-btn {
}

/* ---------- 动画开关：no-anim 时禁用所有动画/过渡 ---------- */
body.no-anim *,
body.no-anim *::before,
body.no-anim *::after {
}

/* ---------- English 旁白整行淡出 ---------- */
@keyframes line-fade-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.narr-line.dissolve-all { animation: line-fade-out 1.2s ease forwards; }


/* ---------- 旁白跳过按钮 ---------- */
#narr-skip {
  display: none;
  position: fixed;
  top: 4rem;
  right: 0.9rem;
  z-index: 1350;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: #cfcfd6;
  background: rgba(18,18,26,0.85);
  border: 1px solid rgba(184,155,94,0.4);
  border-radius: 6px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
#narr-skip.on { display: block; }
#narr-skip:active { color: #fff; border-color: rgba(184,155,94,0.9); }
body.menu-open #narr-skip { display: none !important; }

/* ---------- 开发者：显示所有 UI 边界 ---------- */
body.ui-outline * {
  outline: 1px solid rgba(80, 200, 255, 0.45) !important;
  outline-offset: 0 !important;
}
body.ui-outline button {
  outline: 1px solid rgba(255, 80, 80, 0.8) !important;
}
body.ui-outline .menu-btn,
body.ui-outline .set-opt {
  outline: 1px solid rgba(255, 200, 80, 0.8) !important;
}
body.ui-outline .token,
body.ui-outline .c1-player,
body.ui-outline .c1-cell {
  outline: 1px solid rgba(120, 255, 120, 0.7) !important;
}
body.ui-outline #narration,
body.ui-outline .c1-narr,
body.ui-outline .narr-stack,
body.ui-outline p.narr-line {
  outline: 1px solid rgba(255, 120, 255, 0.8) !important;
}


/* ---------- 成就弹出条（右上角，不挡按钮） ---------- */
.ach-pop {
  position: fixed;
  top: 4.4rem;
  right: 0.6rem;
  z-index: 99998;
  max-width: 62vw;
  padding: 0.55rem 0.85rem;
  background: rgba(18,18,26,0.96);
  border: 1px solid rgba(184,155,94,0.6);
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(184,155,94,0.25);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(.2,.8,.3,1);
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.ach-pop.on { transform: translateX(0); }
.ach-pop-title {
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: #7d7d88;
  margin-bottom: 0.3rem;
}
.ach-pop-name {
  font-size: 0.88rem;
  letter-spacing: 0.16em;
  color: #e8c46a;
  text-shadow: 0 0 14px rgba(232,196,106,0.6);
}
.ach-pop-desc {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: #9a9aa6;
  margin-top: 0.2rem;
}
