/* 章节开场动画 · 播放器外壳
   作用域：.ics 前缀，只在开场动画挂载期间存在，不影响站内其他样式 */

@font-face {
  font-family: 'PangMenZhengDao';
  src: url('../fonts/pangmenzhengdao.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Morena';
  src: url('../fonts/Morena-Bold.otf') format('opentype');
  font-weight: 400 700;
  font-display: swap;
}

body.ics-lock {
  overflow: hidden;
}

.ics {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow: hidden;
  background: #04101f;
  color: #f2f7ff;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  animation: ics-shell-in 0.45s ease both;
}

.ics--out {
  animation: ics-shell-out 0.5s ease forwards;
  pointer-events: none;
}

/* ---------- 背景 ---------- */
.ics-bg {
  position: absolute;
  inset: -6%;
  z-index: 0;
}

.ics-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  animation: ics-kenburns 9.5s ease-out both;
  will-change: transform;
}

/* 飞船断裂处的能量光，缓慢呼吸 */
.ics-glow {
  position: absolute;
  left: 43%;
  top: 72%;
  width: 36vmin;
  height: 36vmin;
  margin: -18vmin 0 0 -18vmin;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 201, 240, 0.5) 0%, rgba(76, 201, 240, 0.16) 38%, rgba(4, 16, 31, 0) 70%);
  mix-blend-mode: screen;
  animation: ics-pulse 2.6s ease-in-out 0.4s infinite;
  pointer-events: none;
}

/* 漂浮碎片 */
.ics-debris {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.ics-debris i {
  position: absolute;
  display: block;
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(140deg, #dfe8f5, #7d93ad);
  opacity: 0.75;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.ics-debris i:nth-child(1) {
  left: 58%;
  top: 26%;
  animation: ics-drift-a 9s ease-in-out infinite;
}

.ics-debris i:nth-child(2) {
  left: 71%;
  top: 62%;
  width: 7px;
  height: 5px;
  animation: ics-drift-b 11s ease-in-out infinite;
}

.ics-debris i:nth-child(3) {
  left: 36%;
  top: 70%;
  width: 12px;
  height: 8px;
  animation: ics-drift-a 13s ease-in-out 1s infinite;
}

.ics-debris i:nth-child(4) {
  left: 84%;
  top: 34%;
  width: 6px;
  height: 4px;
  animation: ics-drift-b 10s ease-in-out 0.6s infinite;
}

/* ---------- 宇航员 ---------- */
.ics-astro {
  position: absolute;
  left: calc(7% + 100px);
  bottom: -4%;
  z-index: 3;
  height: 72vh;
  max-height: 80%;
  pointer-events: none;
  animation: ics-astro-in 1.5s cubic-bezier(0.22, 0.8, 0.3, 1) 0.25s both;
}

.ics-astro img {
  height: 100%;
  width: auto;
  display: block;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, 0.6));
  animation: ics-float 7s ease-in-out 1.8s infinite;
}

/* ---------- 维修机器人 LEO（右边缘与文字右对齐） ---------- */
.ics-leo {
  position: absolute;
  right: calc(8% + 250px);
  bottom: calc(5% + 120px);
  z-index: 3;
  height: 24vh;
  pointer-events: none;
  animation: ics-leo-in 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) 2.2s both;
}

.ics-leo img {
  height: 100%;
  width: auto;
  display: block;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.6));
  animation: ics-float 6s ease-in-out 3.2s infinite;
}

/* ---------- 压暗与字幕底衬 ---------- */
.ics-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse 36% 30% at 60% 49%, rgba(3, 12, 24, 0.8) 0%, rgba(3, 12, 24, 0.48) 58%, rgba(3, 12, 24, 0) 100%),
    radial-gradient(ellipse 44% 36% at 82% 26%, rgba(4, 16, 31, 0.6) 0%, rgba(4, 16, 31, 0) 72%),
    radial-gradient(ellipse 58% 46% at 64% 76%, rgba(4, 16, 31, 0.66) 0%, rgba(4, 16, 31, 0) 72%),
    linear-gradient(to bottom, rgba(4, 16, 31, 0.62) 0%, rgba(4, 16, 31, 0.18) 26%, rgba(4, 16, 31, 0) 46%),
    linear-gradient(to right, rgba(4, 16, 31, 0.72) 0%, rgba(4, 16, 31, 0.12) 42%, rgba(4, 16, 31, 0) 62%),
    linear-gradient(to top, rgba(4, 16, 31, 0.88) 0%, rgba(4, 16, 31, 0.28) 28%, rgba(4, 16, 31, 0) 52%);
}

/* ---------- 标题 ---------- */
.ics-copy {
  position: absolute;
  left: 7%;
  top: 10%;
  z-index: 6;
  max-width: min(62%, 760px);
}

.ics-eyebrow {
  margin: 0 0 10px;
  font-size: clamp(12px, 1.5vw, 15px);
  letter-spacing: 0.34em;
  color: #4cc9f0;
  text-transform: none;
  animation: ics-rise 0.8s ease 0.45s both;
}

.ics-title {
  margin: 0;
  font-family: 'PangMenZhengDao', 'Noto Sans SC', sans-serif;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.22;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75), 0 6px 28px rgba(0, 0, 0, 0.6);
  animation: ics-rise 0.9s ease 0.65s both;
}

/* 长标题自动降一档字号，避免折行 */
.ics-title--long {
  font-size: clamp(28px, 3.6vw, 44px);
}

.ics-title--xlong {
  font-size: clamp(24px, 3vw, 36px);
}

/* 右上角 DAY 标（Morena 常规字重，右对齐，紧贴文案上方） */
.ics-day {
  position: absolute;
  right: calc(8% + 250px);
  top: calc(7% + 115px);
  z-index: 6;
  margin: 0;
  font-family: 'Morena', 'Times New Roman', serif;
  font-weight: 400;
  font-synthesis: none;
  font-size: clamp(54px, 7.8vw, 124px);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: rgba(242, 247, 255, 0.92);
  text-align: right;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  animation: ics-rise 1s ease 0.5s both;
}

.ics-title::after {
  content: "";
  display: block;
  width: 76px;
  height: 2px;
  margin-top: 18px;
  background: linear-gradient(to right, #4cc9f0, rgba(76, 201, 240, 0));
  animation: ics-grow 0.9s ease 1.1s both;
}

/* ---------- 右侧文案（避开宇航员，靠右摆放） ---------- */
.ics-aside {
  position: absolute;
  right: calc(8% + 250px);
  top: calc(44% + 50px);
  z-index: 6;
  width: min(600px, 40vw);
  transform: translateY(-50%);
  text-align: left;
}

/* 右侧构图：宇航员在右、文案在左（人物图片已预先镜像，面朝画面内） */
.ics--right .ics-astro {
  left: auto;
  right: calc(8% + 250px);
}

.ics--right .ics-copy {
  left: calc(7% + 200px);
  right: auto;
}

.ics--right .ics-aside {
  right: auto;
  left: calc(7% + 200px);
  width: min(740px, 47vw);
}

.ics--right .ics-leo {
  right: auto;
  left: calc(7% + 200px);
  bottom: 5%;
}

.ics--right .ics-glow {
  left: 57%;
}

.ics--right .ics-scrim {
  transform: scaleX(-1);
}

.ics-captions {
  text-align: left;
}

.ics-captions::before {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin: 0 0 16px;
  background: linear-gradient(to right, #4cc9f0, rgba(76, 201, 240, 0));
  animation: ics-grow 0.7s ease 1.9s both;
}

.ics-line {
  margin: 0 0 12px;
  font-size: clamp(15px, 1.9vw, 21px);
  line-height: 1.8;
  letter-spacing: 0.02em;
  color: #e8f2ff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
  animation: ics-line-in 0.9s ease both;
}

/* 长句章节整体降一档，避免字幕折行 */
.ics-captions--dense .ics-line {
  font-size: clamp(14px, 1.65vw, 18px);
  margin-bottom: 10px;
}

.ics-line:last-child {
  margin-bottom: 0;
  color: #ffd166;
}

/* ---------- 按钮 ---------- */
.ics-actions {
  margin-top: 30px;
  text-align: left;
}

.ics-cta {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(76, 201, 240, 0.65);
  background: rgba(9, 32, 54, 0.72);
  color: #f2f7ff;
  font: inherit;
  font-size: clamp(14px, 1.6vw, 17px);
  letter-spacing: 0.14em;
  padding: 13px 34px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(76, 201, 240, 0.4), 0 14px 34px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  animation: ics-cta-in 0.7s ease 6.4s both;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.ics-cta:hover,
.ics-cta:focus-visible {
  background: rgba(20, 62, 96, 0.9);
  border-color: #4cc9f0;
  transform: translateY(-1px);
  outline: none;
}

/* 主按钮统一「开始 ▶」：三角用 CSS 画，随字号缩放 */
.ics-cta::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: translateY(0.5px);
}

.ics-list {
  appearance: none;
  margin-left: 10px;
  border: 1px solid rgba(180, 208, 240, 0.35);
  background: transparent;
  color: #cfe0f5;
  font: inherit;
  font-size: clamp(12px, 1.4vw, 14px);
  letter-spacing: 0.08em;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  animation: ics-cta-in 0.7s ease 6.5s both;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ics-list:hover,
.ics-list:focus-visible {
  background: rgba(20, 62, 96, 0.6);
  border-color: rgba(120, 200, 240, 0.7);
  outline: none;
}

@media (max-width: 560px) {
  .ics-list { margin: 12px 0 0; }
}

.ics-hint {
  display: block;
  width: max-content;
  margin: 14px 0 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(4, 16, 31, 0.5);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: rgba(226, 238, 252, 0.82);
  animation: ics-cta-in 0.7s ease 6.8s both;
}

.ics-skip {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 8;
  appearance: none;
  border: 1px solid rgba(226, 238, 252, 0.28);
  background: rgba(6, 22, 38, 0.55);
  color: rgba(226, 238, 252, 0.85);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  animation: ics-cta-in 0.6s ease 0.8s both;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.ics-skip:hover,
.ics-skip:focus-visible {
  border-color: rgba(76, 201, 240, 0.8);
  color: #fff;
  outline: none;
}

/* ---------- 进度条 ---------- */
.ics-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  height: 2px;
  background: rgba(226, 238, 252, 0.12);
}

.ics-progress i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(to right, #4cc9f0, #ffd166);
  animation: ics-progress 9.8s linear both;
}

/* ---------- 动画 ---------- */
@keyframes ics-shell-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ics-shell-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.015); }
}

@keyframes ics-kenburns {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.4%, -1.2%, 0); }
}

@keyframes ics-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes ics-drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(-16px, 10px, 0) rotate(18deg); }
}

@keyframes ics-drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(12px, -14px, 0) rotate(-22deg); }
}

@keyframes ics-astro-in {
  from { opacity: 0; transform: translate3d(-4%, 8%, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ics-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
}

@keyframes ics-leo-in {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.9); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes ics-rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ics-grow {
  from { opacity: 0; transform: scaleX(0); transform-origin: left center; }
  to { opacity: 1; transform: scaleX(1); transform-origin: left center; }
}

@keyframes ics-line-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0); filter: blur(4px); }
  to { opacity: 1; transform: translate3d(0, 0, 0); filter: blur(0); }
}

@keyframes ics-cta-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ics-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* 播放结束：进度条停满、主按钮开始呼吸，等用户点击（不再自动掠过） */
.ics--ready .ics-progress i {
  animation: none;
  transform: scaleX(1);
  opacity: 0.35;
}

.ics--ready .ics-cta {
  animation: ics-cta-breathe 2.6s ease-in-out infinite;
}

@keyframes ics-cta-breathe {
  0%, 100% { box-shadow: 0 10px 30px rgba(76, 201, 240, 0.16); }
  50% { box-shadow: 0 12px 40px rgba(76, 201, 240, 0.46); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  .ics-astro {
    height: 40vh;
    left: -10%;
    bottom: -2%;
  }

  .ics-leo {
    height: 16vh;
    right: 7%;
    bottom: 4%;
  }

  .ics-copy {
    left: 7%;
    top: 8%;
    right: 7%;
    max-width: none;
  }

  .ics-aside {
    left: 7%;
    right: 7%;
    top: 40%;
    width: auto;
    transform: translateY(-50%);
  }

  .ics-captions {
    width: auto;
  }

  .ics-line {
    font-size: 14px;
  }

  .ics-actions {
    margin-top: 22px;
  }

  .ics-debris i:nth-child(3),
  .ics-debris i:nth-child(4) {
    display: none;
  }
}

/* ---------- 降低动态偏好 ---------- */
.ics--static,
.ics--static * {
  animation: none !important;
}

.ics--static .ics-progress {
  display: none;
}

.ics--static .ics-skip {
  display: none;
}
