/* ==========================================================================
   CHAPTER 05: 重生之我在 2011 年 1 月 21 日 — 全屏短片 + 精确秒数大小字幕
   100% 全屏铺满 chapter05.mp4，支持画面中央大字幕与底部正常电影字幕无缝交替
   ========================================================================== */

.ch5-layer {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: #060608;
  color: #fffdf8;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.95s;
}

body[data-mode="chapter05"] .ch5-layer {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}

body[data-mode="chapter05"] .topbar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* 100% 全屏铺满视频画面 */
.ch5-video-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #060608;
}

.ch5-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transform: scale(1);
  transition: transform 2.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.ch5-video.is-holding {
  transform: scale(1.028);
}

/* 柔和底部字幕渐变衬底 */
.ch5-bottom-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38vh;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(6, 7, 10, 0) 0%,
    rgba(6, 7, 10, 0.42) 48%,
    rgba(6, 7, 10, 0.82) 100%
  );
}

/* 画面正中央大字幕（00:01 与 00:06 两处核心转折大字） */
.ch5-center-stage {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(1080px, 90vw);
  z-index: 9;
  text-align: center;
  pointer-events: none;
}

.ch5-center-cue {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch5-center-cue.is-active {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.ch5-center-text {
  margin: 0;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: clamp(2rem, 3.8vw, 3.45rem);
  font-weight: 700;
  line-height: 1.48;
  letter-spacing: 0.14em;
  color: #ffffff;
  text-shadow:
    0 4px 20px rgba(0, 0, 0, 0.78),
    0 10px 42px rgba(0, 0, 0, 0.56);
}

.ch5-center-gold {
  background: linear-gradient(180deg, #FFF6DF 0%, #F4D79A 56%, #CFA462 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(243, 208, 138, 0.44)) drop-shadow(0 6px 20px rgba(0, 0, 0, 0.8));
}

/* 底部正常电影字幕 */
.ch5-sub-stage {
  position: absolute;
  left: 50%;
  bottom: clamp(48px, 7.5vh, 84px);
  transform: translateX(-50%);
  width: min(920px, 92vw);
  z-index: 8;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 92px;
  pointer-events: none;
}

.ch5-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch5-cue.is-active {
  opacity: 1;
  transform: translateY(0);
}

.ch5-sub-text {
  margin: 0;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: clamp(1.08rem, 1.62vw, 1.44rem);
  font-weight: 500;
  line-height: 1.72;
  letter-spacing: 0.08em;
  color: #fffdf7;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.92),
    0 5px 24px rgba(0, 0, 0, 0.74);
}

.ch5-final-date {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 1.25vw, 1.15rem);
  letter-spacing: 0.24em;
  color: rgba(255, 236, 194, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.ch5-final-love {
  margin: 0;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: clamp(1.55rem, 2.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  background: linear-gradient(180deg, #FFF5DC 0%, #F4D79A 56%, #CFA462 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(243, 208, 138, 0.45)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.85));
}

/* 结尾轻交互按钮 */
.ch5-end-actions {
  position: absolute;
  left: 50%;
  bottom: clamp(178px, 22vh, 224px);
  transform: translateX(-50%) translateY(12px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.85s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch5-end-actions.is-ready {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.ch5-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: 999px;
  border: 1px solid rgba(243, 208, 138, 0.52);
  background: rgba(16, 14, 14, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff5de;
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 0 28px -8px rgba(243, 208, 138, 0.42);
  transition: transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.ch5-action-btn:hover {
  transform: translateY(-2px);
  background: rgba(243, 208, 138, 0.2);
  border-color: rgba(255, 245, 218, 0.92);
}

/* 底部 2px 进度条 + 右下角极简控制 */
.ch5-progress-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.ch5-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(243, 208, 138, 0.55), #f3d08a, #fff6de);
  box-shadow: 0 0 10px rgba(243, 208, 138, 0.72);
}

.ch5-controls {
  position: fixed;
  right: 24px;
  bottom: 14px;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ch5-ctrl-link {
  border: none;
  background: rgba(8, 8, 10, 0.42);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 5px 11px;
  color: rgba(246, 242, 234, 0.68);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.ch5-ctrl-link:hover {
  color: #fff4da;
  background: rgba(243, 208, 138, 0.2);
}

/* ===== 第五章 → 扭蛋机：一句俏皮话过场，然后全屏进入扭蛋机 ===== */
.ch5-end-actions { display: none !important; }
.ch6-gacha-layer { position: fixed; inset: 0; z-index: 210; background: #07060a; opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0s linear 0.9s; }
.ch6-gacha-layer.is-visible { opacity: 1; visibility: visible; transition: opacity 0.9s ease, visibility 0s; }
.ch6-gacha-layer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity 0.8s ease; }
.ch6-gacha-layer.is-loaded iframe { opacity: 1; }
.ch6-bridge { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; text-align: center; transition: opacity 0.7s ease; }
.ch6-gacha-layer.is-loaded .ch6-bridge { opacity: 0; }
.ch6-bridge-line { margin: 0; color: rgba(255, 244, 222, 0.78); font-size: clamp(18px, 2.2vw, 28px); letter-spacing: 0.18em; opacity: 0; transform: translateY(10px); }
.ch6-bridge-line.is-big { color: #ffe3a3; font-size: clamp(28px, 4vw, 54px); font-weight: 700; letter-spacing: 0.12em; text-shadow: 0 0 28px rgba(255, 200, 110, 0.45); }
.ch6-gacha-layer.is-visible .ch6-bridge-line { animation: ch6-line 0.9s cubic-bezier(.2,.8,.2,1) forwards; }
.ch6-gacha-layer.is-visible .ch6-bridge-line.is-big { animation-delay: 0.7s; }
.ch6-emoji { display: inline-block; animation: ch6-wiggle 1.2s ease-in-out 1.4s infinite; }
@keyframes ch6-line { to { opacity: 1; transform: none; } }
@keyframes ch6-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(14deg) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .ch6-bridge-line { animation: none !important; opacity: 1; transform: none; } .ch6-emoji { animation: none; } }

/* 结尾唯一按钮：解锁隐藏彩蛋机（字幕正下方，柔和浮现 + 微光呼吸） */
.ch5-unlock-btn {
  margin-top: 14px;
  padding: 12px 30px;
  border-radius: 999px;
  border: 1px solid rgba(243, 208, 138, 0.75);
  background: linear-gradient(180deg, rgba(255, 246, 222, 0.16), rgba(243, 208, 138, 0.1)), rgba(12, 10, 8, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffe9b8;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: clamp(0.98rem, 1.3vw, 1.12rem);
  letter-spacing: 0.22em;
  text-shadow: 0 0 12px rgba(255, 210, 130, 0.55);
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 1s, background 0.25s ease;
}
.ch5-unlock-btn.is-ready {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s, background 0.25s ease;
  animation: ch5-unlock-breathe 2.6s ease-in-out 1s infinite;
}
.ch5-unlock-btn:hover { background: linear-gradient(180deg, rgba(255, 246, 222, 0.26), rgba(243, 208, 138, 0.18)), rgba(12, 10, 8, 0.45); }
.ch5-unlock-btn:focus-visible { outline: 2px solid #f3d08a; outline-offset: 4px; }
.ch5-unlock-btn:disabled { cursor: default; }
@keyframes ch5-unlock-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(243, 208, 138, 0.18), 0 0 14px rgba(243, 208, 138, 0.25); }
  50% { box-shadow: 0 0 0 1px rgba(243, 208, 138, 0.4), 0 0 30px rgba(243, 208, 138, 0.6); }
}
@media (prefers-reduced-motion: reduce) { .ch5-unlock-btn.is-ready { animation: none; } }
