:root {
  /* 数字雨的字号：两侧飘字也跟着它走，改这一处就行 */
  --rain-size: 36px;
}

* {
  padding: 0;
  margin: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background-color: black;
}

audio {
  position: fixed;
  padding: 10px;
  right: 0;
  z-index: 200;
  outline: none;
}

#scene {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
}

.img {
  width: 110vw;
  height: 110vh;
  background-size: cover;
  background-position: top center;
}

.font {
  background-image: url("img/font.png"); /* 文字层保持 PNG，要锐利 */
}

.bg {
  background-image: url("img/bg.webp");
}

.girl1 {
  width: 100vw;
  height: 100vh;
  background-image: url("img/girl1.webp");
  margin-top: 15vh;
}

.girl2 {
  width: 90vw;
  height: 90vh;
  background-image: url("img/girl2.webp");
  margin-left: 9vh;
  margin-top: 22vh;
}

.grassland {
  width: 130vw;
  height: 130vh;
  background-image: url("img/grassland.webp");
  margin-top: -16vh;
}

.leaf {
  margin-top: 60px;
  background-image: url("img/leaf.webp");
  filter: blur(4px);
}

/* ============ 歌词层 ============ */

/* 压暗层：换背景后如果觉得太暗/太亮，改这几个 rgba 的透明度即可 */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.55) 0%,
      rgba(0, 0, 0, 0.2) 35%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0.6) 100%
    ),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.55));
}

.lyrics {
  position: relative;
  z-index: 10;
  height: 100vh;
  overflow: hidden;
  color: #f1f1f1;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong",
    serif;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.75);
  -webkit-font-smoothing: antialiased;
}

/* 每一句占满一屏，整条轨道靠 translateY 逐屏移动 */
.stage {
  height: 100vh;
  transition: transform 1s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}

.slide {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 0 7vw;
}

/* 统一淡入：默认隐藏，当前屏 .is-active 时才浮现 */
.line,
.hero-artist,
.hero-title,
.hero-scroll,
.outro-mark {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(8px);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 1.2s ease;
}

.slide.is-active .line,
.slide.is-active .hero-artist,
.slide.is-active .hero-title,
.slide.is-active .hero-scroll,
.slide.is-active .outro-mark {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* 首屏三行错开出现 */
.slide.is-active .hero-artist {
  transition-delay: 0.15s;
}

.slide.is-active .hero-title {
  transition-delay: 0.35s;
}

.slide.is-active .hero-scroll {
  transition-delay: 0.6s;
}

.hero-artist {
  position: relative;
  z-index: 2; /* 压在云朵上面 */
  font-size: clamp(0.75rem, 1.4vw, 1rem);
  letter-spacing: 0.35em;
  color: rgba(241, 241, 241, 0.6);
}

.hero-title {
  font-size: clamp(2rem, 7vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.hero-scroll {
  margin-top: 2rem;
  font-size: 0.8rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(241, 241, 241, 0.55);
}

.hero-scroll span {
  display: inline-block;
  animation: pulse 2.4s ease-in-out 1.6s infinite;
}

.hero-scroll::after {
  content: "";
  display: block;
  width: 1px;
  height: 42px;
  margin: 0.8rem auto 0;
  background: currentColor;
  animation: pulse 2.4s ease-in-out 1.6s infinite;
}

.line {
  position: relative;
  z-index: 2;
  max-width: 20em;
  font-size: clamp(1.3rem, 3.4vw, 2.5rem);
  line-height: 1.9;
  letter-spacing: 0.06em;
}

.outro-mark {
  font-size: clamp(0.8rem, 1.6vw, 1.1rem);
  letter-spacing: 0.6em;
  color: rgba(241, 241, 241, 0.5);
}

/* ============ 左侧/右侧黑客帝国式数字雨（只用在第三句那一屏） ============ */
.matrix-rain {
  /* 想换颜色改这两个变量就行 */
  --rain-color: #f1f1f1;
  --rain-glow: rgba(255, 255, 255, 0.45);
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.rain-side {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  gap: 0.9rem;
}

.rain-side.left {
  left: 5.5rem;
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 100%);
}

.rain-side.right {
  right: 5.5rem;
  -webkit-mask-image: linear-gradient(270deg, #000 45%, transparent 100%);
  mask-image: linear-gradient(270deg, #000 45%, transparent 100%);
}

.rain-col {
  width: 1.2em; /* 跟着下面的 font-size 自动变，改字号不用再改这里 */
  height: 100%;
  overflow: hidden;
  pointer-events: auto; /* 让雨列能接收鼠标，悬停暂停才好点 */
  font-family: "Courier New", Consolas, monospace;
  font-size: var(--rain-size);
  line-height: 1.1;
  letter-spacing: 5px;
  color: var(--rain-color);
  text-shadow: 0 0 6px var(--rain-glow), 0 0 14px var(--rain-glow);
  opacity: 0.8;
}

.rain-col:hover {
  opacity: 1;
}

.rain-flow {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  animation: rain-fall linear infinite;
  animation-play-state: paused; /* 不是当前屏就不流动，省性能 */
}

.slide.is-active .rain-flow {
  animation-play-state: running;
}

/* 鼠标移到某一列上就暂停，方便点名字 */
.slide.is-active .rain-col:hover .rain-flow {
  animation-play-state: paused;
}

/* 雨里的名字：能点的（链接或弹窗）才亮起来提示 */
.rain-name {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.rain-name.is-clickable {
  cursor: pointer;
}

.rain-name.is-clickable:hover,
.rain-name.is-clickable:focus-visible {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.95),
    0 0 22px rgba(255, 255, 255, 0.75);
  outline: none;
}

/* 名字之间的分隔符 */
.rain-sep {
  color: rgba(241, 241, 241, 0.45);
}

/* 字符复制了一整份，位移半程刚好接上，循环无痕 */
@keyframes rain-fall {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* ============ 指南弹窗（液态玻璃） ============ */
.glass-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  pointer-events: none;
  /* 这里故意不写 opacity：父级一旦有 opacity 动画，弹窗的 backdrop-filter
     在动画期间会采样到错的背景，动画结束那一瞬间就会"突变"。
     压暗改由下面单独的 .glass-dim 负责淡入。 */
}

.glass-overlay.is-open {
  pointer-events: auto;
}

.glass-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none; /* 点空白处照样落到 overlay 上，方便关闭 */
  transition: opacity 0.35s ease;
}

.glass-overlay.is-open .glass-dim {
  opacity: 1;
}

.glass-card {
  position: relative;
  width: min(680px, 100%);
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  padding: 2rem 2.2rem 1.6rem;
  border-radius: 26px;
  color: #f1f1f1;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong",
    serif;
  text-align: left;
  background: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  opacity: 0; /* 淡入放在弹窗自己身上，不放在父级 */
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 左上角那层高光，玻璃感主要靠它 */
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    130% 90% at 12% 0%,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0) 62%
  );
}

.glass-overlay.is-open .glass-card {
  opacity: 1;
  transform: none;
}

.glass-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(241, 241, 241, 0.85);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.3s ease;
}

.glass-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.glass-title {
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.glass-body {
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 2;
  color: rgba(241, 241, 241, 0.88);
}

.glass-body p + p {
  margin-top: 1em;
}

/* 弹窗里嵌网页时：卡片放大，正文交给 iframe 撑满 */
.glass-card.is-embed {
  width: min(1000px, 100%);
  height: 80vh;
  max-height: 84vh;
  padding: 1.6rem 1.6rem 1.2rem;
}

.glass-card.is-embed .glass-title {
  margin-bottom: 0.7rem;
  font-size: 1.1rem;
}

.glass-card.is-embed .glass-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.glass-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

/* 兜底：万一嵌不进来，点这里在新标签打开 */
.glass-open-link {
  align-self: flex-end;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: rgba(241, 241, 241, 0.6);
  text-decoration: none;
  transition: color 0.3s ease;
}

.glass-open-link:hover {
  color: #fff;
}

/* ============ 云朵（第二屏 / 第五屏） ============ */
.cloud-field {
  position: absolute;
  inset: 0;
  z-index: 50; /* 放到内容层最上，盖过中间的标题和正文，避免被压住 */
  pointer-events: none;
  overflow: hidden;
}

/* 左右各一条带，文字只在带内活动，不会跑到中间压字 */
.cloud-side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(50% - 16rem); /* 内侧离中线留 16rem 给中间的文字 */
  overflow: hidden;
}

.cloud-side.left {
  left: 0;
}

.cloud-side.right {
  right: 0;
}

.cloud {
  position: absolute;
  box-sizing: border-box; /* 让 JS 设的宽高包含内边距，位置算得才准 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3em;
  border: 0;
  /* 不留任何形状，只有字 */
  font: inherit;
  font-size: var(--rain-size); /* 跟数字雨同字号 */
  letter-spacing: 0.08em;
  white-space: nowrap; /* 不折行，盒子宽度交给文字自己撑 */
  text-align: center;
  color: rgba(244, 244, 246, 0.88);
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  animation: cloud-float 24s ease-in-out infinite;
  animation-play-state: paused; /* 不是当前屏就不飘，省性能 */
  transition: color 0.4s ease, filter 0.4s ease;
}

/* 能点的云才接鼠标：鼠标移上去整朵亮一点 */
.cloud.is-clickable {
  pointer-events: auto;
  cursor: pointer;
}

.cloud.is-clickable:hover,
.cloud.is-clickable:focus-visible {
  color: #fff;
  filter: brightness(1.7);
  outline: none;
}

.slide.is-active .cloud {
  animation-play-state: running;
}

/* 淡入 → 缓慢飘移 → 淡出，位置在不可见的时候复位，看不出接缝 */
@keyframes cloud-float {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.94);
  }
  18% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx, 0), var(--dy, 0), 0) scale(1.06);
  }
}
