/* ============================================================
   双线剧情页样式（复用 style.css 配色令牌）
   模块：背景溶解 / 阵营选择 / 剧情舞台 / 选项 /
         结局认证书 / 羁绊图谱
   ============================================================ */

/* ---------- 页面骨架 ---------- */
body { overflow-x: hidden; }

.bg-layer {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.6s ease;
  z-index: 0;
  filter: brightness(0.42) saturate(0.85);
}

.bg-layer.show { opacity: 1; }

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, transparent 30%, rgba(5, 7, 15, 0.55) 78%),
    linear-gradient(180deg, rgba(5, 7, 15, 0.72) 0%, rgba(5, 7, 15, 0.18) 34%, rgba(5, 7, 15, 0.2) 62%, rgba(5, 7, 15, 0.92) 100%);
}

/* ---------- 阵营选择 ---------- */
#camp-select {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 60px 20px 46px;
}

#camp-select[hidden],
#stage[hidden],
#ending-view[hidden] {
  display: none; /* 三个视图均有显式 display，必须还原 hidden 语义，否则常驻渲染并拦截点击 */
}

.camp-kicker {
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--white-faint);
}

.camp-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 5.4vw, 40px);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--gold-bright);
  text-align: center;
  text-shadow: 0 0 26px rgba(201, 168, 76, 0.35);
}

.camp-sub {
  font-size: var(--fs-aux);
  color: var(--white-dim);
  letter-spacing: 0.14em;
  text-align: center;
  max-width: 34em;
  line-height: 2.1;
}

.camp-cards {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
}

.camp-card {
  width: 240px;
  padding: 34px 24px 28px;
  background: rgba(10, 15, 31, 0.55);
  border: 1px solid var(--line-faint);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
  backdrop-filter: blur(3px);
}

.camp-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.camp-card.taro { border-top: 2px solid rgba(232, 212, 139, 0.75); }
.camp-card.taro:hover { border-color: var(--gold); }

.camp-card.tregear { border-top: 2px solid rgba(91, 127, 184, 0.75); }
.camp-card.tregear:hover { border-color: var(--blue-glow); }

.camp-figure {
  display: block; /* HTML 中为 span，必须转块级，宽高与圆形裁切才能生效 */
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-faint);
}

.camp-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.camp-name {
  display: block; /* span 转块级，与人名英文各行排布 */
  font-family: var(--font-serif);
  font-size: var(--fs-h);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--white-cold);
}

.camp-en {
  display: block;
  font-size: var(--fs-tiny);
  letter-spacing: 0.24em;
  color: var(--white-faint);
  margin: 8px 0 14px;
}

.camp-desc {
  display: block;
  font-size: var(--fs-tiny);
  line-height: 2;
  color: var(--white-dim);
  letter-spacing: 0.08em;
}

#camp-summary {
  margin: 0; /* 容器 flex gap 34px 主导间距，说明文字上移贴近卡片 */
  font-size: var(--fs-aux);
  color: var(--white-faint);
  letter-spacing: 0.1em;
  text-align: center;
}

.camp-links {
  display: flex;
  gap: 26px;
}

.camp-links a {
  color: var(--white-faint);
  text-decoration: none;
  font-size: var(--fs-aux);
  letter-spacing: 0.18em;
  border-bottom: 1px solid transparent;
  transition: color 0.4s ease, border-color 0.4s ease;
}

.camp-links a:hover {
  color: var(--gold-bright);
  border-color: var(--line-faint);
}

/* ---------- 剧情舞台 ---------- */
#stage {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 0 7vh;
}

.chapter-tag {
  position: fixed;
  top: 46px; /* 上移贴近顶端，仍处「离开这条路」按钮（bottom 41px）之下，长标题装饰线不与按钮重叠 */
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--white-dim);
  white-space: nowrap;
  z-index: 5;
}

.chapter-tag::before,
.chapter-tag::after {
  content: "";
  display: inline-block;
  width: 3em;
  height: 1px;
  vertical-align: middle;
  margin: 0 1.2em;
  background: var(--line-faint);
}

.story-box {
  max-width: 640px;
  width: calc(100% - 48px);
  margin: 0 auto;
}

#story-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 34px;
}

.story-line {
  font-family: var(--font-serif);
  font-size: clamp(15px, 2.6vw, 18px);
  line-height: 2.15;
  letter-spacing: 0.1em;
  color: var(--white-cold);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85);
  opacity: 0;
  animation: line-in 1.15s ease forwards;
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ---------- 选项与继续 ---------- */
#story-choices {
  display: flex;
  flex-direction: column;
  gap: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  pointer-events: none;
}

#story-choices.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.choice {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 20px;
  background: rgba(10, 15, 31, 0.5);
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-radius: 3px;
  color: var(--white-cold);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  letter-spacing: 0.08em;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.45s ease, background 0.45s ease, transform 0.45s ease;
  backdrop-filter: blur(2px);
}

.choice::before {
  content: "◆";
  font-size: 9px;
  color: var(--gold);
  opacity: 0.55;
  transition: opacity 0.45s ease;
}

.choice:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  transform: translateX(4px);
}

.choice:hover::before { opacity: 1; }

.choice-text { flex: 1; }

.choice-hint {
  font-size: var(--fs-tiny);
  color: var(--gold);
  opacity: 0.75;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.continue-btn {
  align-self: center;
  padding: 10px 44px;
  background: transparent;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 999px;
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  cursor: pointer;
  animation: continue-breathe 2.4s ease-in-out infinite;
  transition: border-color 0.4s ease, background 0.4s ease;
}

.continue-btn:hover {
  border-color: var(--gold-bright);
  background: rgba(201, 168, 76, 0.12);
  animation: none;
}

@keyframes continue-breathe {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ---------- 结局视图 ---------- */
#ending-view {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  padding: 12vh 0 8vh;
}

#ending-content {
  max-width: 640px;
  width: calc(100% - 48px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ending-tag {
  font-family: var(--font-serif);
  font-size: clamp(22px, 4.6vw, 32px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(201, 168, 76, 0.4);
}

.ending-en {
  margin-top: 10px;
  font-size: var(--fs-tiny);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--white-faint);
}

.ending-lines {
  margin: 40px 0 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ending-quote {
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  line-height: 2.1;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin-bottom: 40px;
}

.true-gate-btn {
  padding: 12px 40px;
  margin-bottom: 40px;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  cursor: pointer;
  animation: continue-breathe 2.4s ease-in-out infinite;
}

.true-gate-btn:hover { background: rgba(201, 168, 76, 0.14); animation: none; }

/* ---------- 结局认证书 ---------- */
.cert-card {
  width: min(380px, 100%);
  padding: 30px 26px 24px;
  border: 1px solid var(--line-faint);
  outline: 1px solid rgba(201, 168, 76, 0.16);
  outline-offset: 5px;
  background:
    linear-gradient(160deg, rgba(10, 15, 31, 0.82), rgba(5, 7, 15, 0.88));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.cert-head {
  font-size: var(--fs-tiny);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--white-faint);
}

.cert-seal {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  line-height: 1.7;
  color: var(--gold-bright);
  border: 2px solid rgba(201, 168, 76, 0.75);
  border-radius: 50%;
  box-shadow: inset 0 0 16px rgba(201, 168, 76, 0.28), 0 0 22px rgba(201, 168, 76, 0.22);
  transform: rotate(-8deg);
}

.cert-double {
  background:
    linear-gradient(105deg, rgba(201, 168, 76, 0.1) 0 50%, rgba(91, 127, 184, 0.14) 50% 100%),
    linear-gradient(160deg, rgba(10, 15, 31, 0.85), rgba(5, 7, 15, 0.9));
}

.cert-double .cert-seal {
  background:
    linear-gradient(120deg, rgba(201, 168, 76, 0.3) 0 50%, rgba(91, 127, 184, 0.34) 50% 100%);
}

.cert-figures {
  display: flex;
  align-items: center;
  gap: 18px;
}

.cert-figure {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-faint);
}

.cert-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.cert-light { box-shadow: 0 0 14px rgba(232, 212, 139, 0.4); }
.cert-dark  { box-shadow: 0 0 14px rgba(91, 127, 184, 0.45); }

.cert-no,
.cert-date {
  font-size: var(--fs-tiny);
  letter-spacing: 0.2em;
  color: var(--white-dim);
}

/* ---------- 操作按钮 ---------- */
.action-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 34px;
}

.action-btn {
  padding: 10px 24px;
  background: transparent;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 999px;
  color: var(--white-dim);
  font-family: var(--font-sans);
  font-size: var(--fs-aux);
  letter-spacing: 0.16em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}

.action-btn:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
}

.action-btn.ghost {
  border-color: rgba(232, 237, 245, 0.22);
  color: var(--white-faint);
}

.action-btn.ghost:hover {
  color: var(--white-cold);
  border-color: rgba(232, 237, 245, 0.45);
  background: rgba(232, 237, 245, 0.06);
}

/* 右上角退出按钮：轻量小尺寸，不抢剧情视觉 */
.exit-btn {
  position: fixed;
  top: 14px;
  right: 12px;
  z-index: 6;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  opacity: 0.7;
  transition: opacity 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.exit-btn:hover {
  opacity: 1;
}

/* ---------- 告别弹窗：真结局后离开时 ---------- */
#farewell-modal {
  position: fixed;
  inset: 0;
  z-index: 80; /* 盖过声音开关（70），弹窗内仍可静音 */
  background: rgba(4, 7, 16, 0.84);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

#farewell-modal[hidden] {
  display: none; /* 显式 display 会覆盖 hidden 属性的默认隐藏，必须还原 */
}

.farewell-card {
  width: min(430px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px 26px 24px;
  background: rgba(8, 12, 26, 0.94);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 4px;
  box-shadow: 0 0 60px rgba(201, 168, 76, 0.08);
}

.farewell-title {
  font-family: var(--font-serif);
  font-size: var(--fs-aux);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-align: center;
  color: var(--gold);
  margin-bottom: 26px;
}

.farewell-voice p {
  font-size: var(--fs-aux);
  line-height: 2.1;
  letter-spacing: 0.1em;
  padding-left: 18px; /* 文本块随竖线内收，留出呼吸 */
  opacity: 0;
  animation: farewell-line 0.7s ease forwards;
}

.voice-dark {
  border-left: 2px solid rgba(110, 150, 210, 0.45);
  padding-left: 14px;
  margin-bottom: 26px; /* 两个声音之间拉开 */
}

.voice-dark p { color: rgba(168, 196, 232, 0.92); }

.voice-light {
  border-left: 2px solid rgba(201, 168, 76, 0.5);
  padding-left: 14px;
}

.voice-light p { color: var(--white-cold); }

.farewell-byline {
  text-align: right;
  padding-right: 4px !important;
  margin-top: 6px;
  font-size: var(--fs-tiny) !important;
  letter-spacing: 0.18em;
}

@keyframes farewell-line {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.farewell-sign {
  margin-top: 20px;
  text-align: center;
  font-size: var(--fs-tiny);
  letter-spacing: 0.2em;
  color: var(--white-faint);
}

.farewell-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ---------- 认证确认弹窗：结局已定，先问是否认证 ---------- */
#cert-ask-modal {
  position: fixed;
  inset: 0;
  z-index: 80; /* 与告别弹窗同层：盖过页面与声音开关 */
  background: rgba(4, 7, 16, 0.84);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

#cert-ask-modal[hidden] {
  display: none; /* 显式 display 会覆盖 hidden 属性的默认隐藏，必须还原 */
}

.cert-ask-card {
  width: min(360px, 100%);
  text-align: center;
  animation: farewell-line 0.7s ease both;
}

.cert-ask-title {
  font-family: var(--font-serif);
  font-size: var(--fs-h);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(201, 168, 76, 0.3);
  margin-bottom: 16px;
}

.cert-ask-text {
  font-size: var(--fs-aux);
  line-height: 2.15;
  letter-spacing: 0.12em;
  color: var(--white-dim);
  margin-bottom: 24px;
}

.cert-ask-note {
  font-size: var(--fs-tiny);
  color: var(--white-faint);
  letter-spacing: 0.1em;
}

/* ---------- 羁绊图谱 ---------- */
.atlas {
  width: min(440px, 100%);
  padding: 24px 22px 20px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  background: rgba(10, 15, 31, 0.5);
}

.atlas-title {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--gold-bright);
  text-align: center;
  margin-bottom: 18px;
}

.atlas-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.atlas-cell {
  min-width: 68px;
  padding: 9px 10px;
  text-align: center;
  font-size: var(--fs-tiny);
  letter-spacing: 0.1em;
  border: 1px solid rgba(232, 237, 245, 0.12);
  color: rgba(232, 237, 245, 0.22);
  border-radius: 2px;
}

.atlas-cell.lit {
  border-color: rgba(201, 168, 76, 0.7);
  color: var(--gold-bright);
  background: rgba(201, 168, 76, 0.1);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.18);
}

.atlas-tip {
  font-size: var(--fs-tiny);
  letter-spacing: 0.12em;
  color: var(--white-faint);
  text-align: center;
}

/* ---------- 减弱动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  .story-line { animation: none; opacity: 1; }
  .bg-layer { transition: none; }
  .continue-btn, .true-gate-btn { animation: none; }
}

/* ---------- 小屏适配（手机竖屏） ---------- */
@media (max-width: 560px) {
  /* 背景：减轻上下遮罩、提亮画面、下移聚焦点，避免竖屏只露出中间一段 */
  .bg-layer { filter: brightness(0.55) saturate(0.9); background-position: center 30%; }
  .bg-layer::after {
    background:
      radial-gradient(ellipse at 50% 40%, transparent 42%, rgba(5, 7, 15, 0.42) 84%),
      linear-gradient(180deg, rgba(5, 7, 15, 0.5) 0%, rgba(5, 7, 15, 0.08) 28%, rgba(5, 7, 15, 0.1) 58%, rgba(5, 7, 15, 0.78) 100%);
  }

  /* 阵营选择：整体上移 + 字号放大 */
  #camp-select { justify-content: flex-start; gap: 22px; padding: 10vh 16px 42px; }
  .camp-title { letter-spacing: 0.16em; text-indent: 0.16em; }
  .camp-sub { font-size: var(--fs-body); letter-spacing: 0.06em; line-height: 1.95; }
  .camp-cards { gap: 14px; }
  .camp-card { width: min(300px, 88vw); padding: 24px 18px 20px; }
  .camp-figure { width: 84px; height: 84px; margin-bottom: 12px; }
  .camp-name { font-size: var(--fs-num); }
  .camp-en { font-size: var(--fs-aux); }
  .camp-desc { font-size: var(--fs-aux); }
  #camp-summary { font-size: var(--fs-body); }

  /* 剧情舞台：段落整体上移（加大底部留白）+ 字号放大 */
  .chapter-tag { font-size: var(--fs-aux); top: 50px; letter-spacing: 0.32em; text-indent: 0.32em; }
  .chapter-tag::before, .chapter-tag::after { width: 1.4em; margin: 0 0.6em; }
  #stage { padding-bottom: 11vh; }
  .story-box { width: calc(100% - 34px); }
  .story-line { font-size: 16px; line-height: 2.05; }
  #story-lines { gap: 10px; margin-bottom: 24px; }
  .choice { padding: 12px 14px; gap: 8px; font-size: 15px; }
  .choice-hint { display: none; }
  .continue-btn { padding: 9px 34px; letter-spacing: 0.36em; text-indent: 0.36em; }
  .exit-btn { top: 10px; right: 10px; padding: 4px 10px; }

  /* 结局视图 */
  #ending-view { padding: 8vh 0 7vh; }
  .ending-tag { font-size: 22px; }
  .ending-en { font-size: var(--fs-aux); }
  .ending-quote { font-size: var(--fs-body); }
  .ending-lines { margin: 26px 0 20px; }
  .true-gate-btn { padding: 11px 26px; letter-spacing: 0.18em; text-indent: 0.18em; }
  .cert-card { padding: 24px 18px 20px; }
  .cert-seal { width: 84px; height: 84px; font-size: 13px; }
  .cert-no, .cert-date { font-size: var(--fs-aux); }
  .action-row { gap: 10px; }
  .action-btn { padding: 9px 18px; letter-spacing: 0.1em; }
  .atlas { padding: 18px 14px 16px; }
  .atlas-title { font-size: var(--fs-h); }
  .atlas-cell { min-width: 58px; padding: 8px; font-size: var(--fs-aux); }

  /* 两个弹窗：收紧内边距、放大正文，保证小屏不溢出 */
  #farewell-modal, #cert-ask-modal { padding: 14px 10px; }
  .farewell-card { padding: 22px 16px 20px; max-height: 90vh; }
  .farewell-title { margin-bottom: 18px; font-size: var(--fs-body); }
  .farewell-voice p { font-size: 15px; line-height: 1.95; padding-left: 12px; }
  .voice-dark { margin-bottom: 20px; padding-left: 10px; }
  .voice-light { padding-left: 10px; }
  .farewell-sign { margin-top: 16px; font-size: var(--fs-aux); }
  .farewell-actions { gap: 10px; margin-top: 16px; }
  .farewell-actions .action-btn { padding: 9px 14px; letter-spacing: 0.08em; }
  .cert-ask-title { font-size: var(--fs-h); }
  .cert-ask-text { font-size: var(--fs-body); margin-bottom: 18px; }
}
