/* ===========================================================
   AI 锻炼 · 动态横幅（替换首页轮播位）
   - 宽幅电影感，六幕循环，3.6s 一幕
   - 全部尺寸用 vmin + clamp，1200×320 与 390×300 都不溢出
   - 无内联脚本（站点 CSP: script-src 'self'）
   =========================================================== */

:root {
  --ink: #06090E;
  --fg: #F3F7FF;
  --dim: rgba(226, 236, 255, .66);
  --faint: rgba(226, 236, 255, .40);
  --accent: #22D3EE;
  --pad: clamp(18px, 3.4vw, 58px);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

.bn {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

/* ── 每一幕 ────────────────────────────────────────────── */
.bn__stage { position: absolute; inset: 0; z-index: 1; }

.beat {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
.beat.is-active { opacity: 1; pointer-events: auto; }

.beat__media {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  /* 图片还没到时也有一层像样的底，不会露白 */
  background:
    radial-gradient(120% 130% at 74% 40%, #1B2637 0%, #0C121C 55%, #070A10 100%);
}
.beat--right .beat__media {
  background: radial-gradient(120% 130% at 26% 40%, #1B2637 0%, #0C121C 55%, #070A10 100%);
}
.beat__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 42%;
  filter: saturate(.94) contrast(1.05);
  transform: scale(1.04);
  opacity: 0;
  transition: opacity .8s ease;
}
.beat__media img.is-loaded { opacity: 1; }
.beat.is-active .beat__media img { transform: scale(1.11); }
.beat.is-active .beat__media img.is-loaded {
  transition: opacity .8s ease, transform 6.4s linear;
}
/* 文字在右，人物就往左让 */
.beat--right .beat__media img { object-position: 28% 42%; }

/* 压暗：文字侧沉下去，人物侧留亮 */
.beat__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(96deg,
      rgba(6, 9, 14, .97) 0%,
      rgba(6, 9, 14, .93) 26%,
      rgba(6, 9, 14, .72) 48%,
      rgba(6, 9, 14, .28) 66%,
      rgba(6, 9, 14, .04) 84%),
    linear-gradient(180deg, rgba(6, 9, 14, .70) 0%, rgba(6, 9, 14, .28) 16%, rgba(6, 9, 14, 0) 32%),
    linear-gradient(0deg, rgba(6, 9, 14, .78) 0%, rgba(6, 9, 14, 0) 34%);
}
.beat--right .beat__scrim {
  background:
    linear-gradient(264deg,
      rgba(6, 9, 14, .97) 0%,
      rgba(6, 9, 14, .93) 26%,
      rgba(6, 9, 14, .72) 48%,
      rgba(6, 9, 14, .28) 66%,
      rgba(6, 9, 14, .04) 84%),
    linear-gradient(180deg, rgba(6, 9, 14, .70) 0%, rgba(6, 9, 14, .28) 16%, rgba(6, 9, 14, 0) 32%),
    linear-gradient(0deg, rgba(6, 9, 14, .78) 0%, rgba(6, 9, 14, 0) 34%);
}

/* 第 2 幕的扫描线 */
.beat__scan { position: absolute; inset: 0; opacity: 0; transition: opacity .4s; }
.beat.is-active .beat__scan { opacity: 1; }
.beat__scan::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8%;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 26px 2px var(--accent);
  opacity: 0;
}
.beat.is-active .beat__scan::after { animation: sweep 3.4s cubic-bezier(.5, 0, .5, 1); }
@keyframes sweep {
  0%   { left: 6%;  opacity: 0; }
  14%  { opacity: .9; }
  86%  { opacity: .9; }
  100% { left: 90%; opacity: 0; }
}

/* ── 文案 ──────────────────────────────────────────────── */
.beat__copy {
  position: absolute;
  top: 50%;
  left: var(--pad);
  width: min(58%, 680px);
  transform: translateY(-50%);
  z-index: 2;
}
.beat--right .beat__copy { left: auto; right: var(--pad); }

.k {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(8px, 2vmin, 18px);
  font-family: var(--mono);
  font-size: clamp(9px, 3.1vmin, 12px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .82);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55);
  white-space: nowrap;
}
.k b { font-weight: 700; color: var(--accent); }
.k i {
  display: block;
  width: 0;
  height: 1px;
  background: var(--accent);
  opacity: .75;
  transition: width .7s var(--ease);
}
.beat.is-active .k i { width: clamp(16px, 4vmin, 34px); }
.k span { color: rgba(255, 255, 255, .62); letter-spacing: .26em; }

.t {
  margin: 0;
  font-size: clamp(23px, 13.2vmin, 62px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -.01em;
  text-wrap: balance;
  text-shadow: 0 2px 26px rgba(0, 0, 0, .55);
}

.s {
  margin: clamp(8px, 2.2vmin, 16px) 0 0;
  font-size: clamp(12.5px, 5.6vmin, 26px);
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, .9);
}

.d {
  margin: clamp(6px, 1.8vmin, 12px) 0 0;
  max-width: 34em;
  font-size: clamp(10px, 3.5vmin, 14px);
  line-height: 1.62;
  color: var(--dim);
}

/* 进场：逐行上浮 */
.k, .t, .s, .d, .cta {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .75s var(--ease);
}
.beat.is-active .k   { opacity: 1; transform: none; transition-delay: .06s; }
.beat.is-active .t   { opacity: 1; transform: none; transition-delay: .14s; }
.beat.is-active .s   { opacity: 1; transform: none; transition-delay: .26s; }
.beat.is-active .d   { opacity: 1; transform: none; transition-delay: .36s; }
.beat.is-active .cta { opacity: 1; transform: none; transition-delay: .44s; }

/* CTA */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(10px, 2.6vmin, 20px);
  padding: clamp(8px, 2.1vmin, 13px) clamp(16px, 3.4vmin, 26px);
  border-radius: 999px;
  background: var(--fg);
  color: #08111c;
  font-size: clamp(11.5px, 3.9vmin, 15px);
  font-weight: 800;
  text-decoration: none;
  pointer-events: none;
  transition: opacity .5s ease, transform .6s var(--ease), background .2s, gap .2s;
}
.beat.is-active .cta { pointer-events: auto; }
.cta span { transition: transform .25s var(--ease); }
.cta:hover { background: #fff; gap: 14px; }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 巨大的幕次底纹字 */
.beat__n {
  position: absolute;
  right: 4%;
  bottom: 17%;
  z-index: 1;
  font-family: var(--mono);
  font-size: clamp(58px, 25vmin, 160px);
  font-weight: 200;
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .10);
  user-select: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1s ease, transform 1s var(--ease);
}
.beat--right .beat__n { right: auto; left: 4%; }
.beat.is-active .beat__n { opacity: 1; transform: none; }

/* ── 界面层 ────────────────────────────────────────────── */
.chrome {
  position: absolute;
  z-index: 6;
  font-size: clamp(9.5px, 2.9vmin, 12px);
  color: var(--fg);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .6);
  pointer-events: none;
}
.chrome--tl { top: clamp(14px, 4vmin, 26px); left: var(--pad); }
.chrome--tr { top: clamp(14px, 4vmin, 26px); right: var(--pad); }
.chrome--bl {
  bottom: clamp(12px, 3.4vmin, 22px);
  left: var(--pad);
  right: 42%;
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.2vmin, 18px);
  min-width: 0;
}
.chrome--br {
  bottom: clamp(11px, 3.1vmin, 20px);
  right: var(--pad);
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.4vmin, 18px);
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: .06em;
}
.brand i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}
.brand__sub {
  font-family: var(--mono);
  font-size: .82em;
  font-weight: 500;
  letter-spacing: .2em;
  color: var(--faint);
}

.counter {
  font-family: var(--mono);
  letter-spacing: .12em;
  color: rgba(226, 236, 255, .66);
  font-variant-numeric: tabular-nums;
}

.privacy {
  margin: 0;
  min-width: 0;
  font-size: clamp(9px, 2.7vmin, 11.5px);
  letter-spacing: .02em;
  color: rgba(226, 236, 255, .48);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 进度条 */
.ticks { display: flex; align-items: center; gap: 5px; }
.tick {
  position: relative;
  width: clamp(16px, 3.2vmin, 26px);
  height: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}
.tick::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .24);
}
.tick i {
  position: absolute;
  left: 0; top: 50%;
  width: 100%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, .5);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
}
.tick:hover::before { background: rgba(255, 255, 255, .45); }
.tick:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* 暂停 */
.pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--fg);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.pause:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .45); }
.pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pause__bar { width: 2px; height: 8px; background: currentColor; border-radius: 1px; }
.pause.is-paused .pause__bar {
  width: 0; height: 0; background: none; border-radius: 0;
  border-left: 7px solid currentColor;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}
.pause.is-paused .pause__bar + .pause__bar { display: none; }

/* 完整故事入口 */
.jump {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: clamp(9px, 2.7vmin, 11px);
  letter-spacing: .1em;
  color: var(--faint);
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
  transition: color .2s;
  border-bottom: 1px solid transparent;
}
.jump:hover { color: var(--fg); border-bottom-color: rgba(255, 255, 255, .35); }
.jump:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.jump span { display: inline-block; transition: transform .2s var(--ease); }
.jump:hover span { transform: translateX(3px); }

/* 颗粒与扫描线 */
.bn__grain {
  position: absolute;
  inset: -60%;
  z-index: 3;
  pointer-events: none;
  opacity: .13;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.55'/></svg>");
  animation: grain 1.1s steps(3) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-2%, 1.5%); }
  66%  { transform: translate(1.5%, -1%); }
  100% { transform: translate(0, 0); }
}
.bn__scan {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: .5;
  background: repeating-linear-gradient(0deg,
    rgba(255, 255, 255, .028) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px);
}

/* 内容加载前先黑一下，避免闪白 */
.bn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease .2s;
}
.bn.is-boot::after { opacity: 1; transition: none; }

/* 悬停时不显示鼠标手型（非链接区域） */
.beat__copy, .beat__media { cursor: default; }

/* ── 窄屏 / 手机：改为底部压字 ─────────────────────────── */
@media (max-aspect-ratio: 8/5) {
  .beat__scrim,
  .beat--right .beat__scrim {
    background:
      linear-gradient(0deg,
        rgba(6, 9, 14, .97) 0%,
        rgba(6, 9, 14, .95) 36%,
        rgba(6, 9, 14, .74) 60%,
        rgba(6, 9, 14, .30) 82%,
        rgba(6, 9, 14, .22) 100%);
  }
  .beat__media img,
  .beat--right .beat__media img { object-position: 50% 34%; }

  .beat__copy,
  .beat--right .beat__copy {
    top: auto;
    bottom: clamp(58px, 17vmin, 78px);
    left: var(--pad);
    right: var(--pad);
    width: auto;
    transform: none;
  }
  .t { font-size: clamp(22px, 8.6vmin, 38px); line-height: 1.18; }
  .s { font-size: clamp(12px, 4.6vmin, 17px); }
  .d { font-size: clamp(10px, 3.6vmin, 12.5px); max-width: 30em; }
  .beat__n { display: none; }
  /* 底部两层：上面一行隐私说明，下面一行进度与暂停，互不压字 */
  .chrome--bl {
    right: var(--pad);
    bottom: clamp(38px, 11vmin, 48px);
    overflow: hidden;
  }
  .privacy {
    font-size: clamp(8.5px, 2.9vmin, 10.5px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chrome--br { bottom: clamp(8px, 2.6vmin, 12px); }
  .privacy { font-size: clamp(8.5px, 2.9vmin, 10.5px); }
  .jump { display: none; }
  .brand__sub { display: none; }
  .tick { width: clamp(12px, 4.4vmin, 22px); }
}

/* 极矮（例如塞进 180px 的旧轮播位） */
@media (max-height: 210px) {
  .d { display: none; }
  .s { margin-top: 6px; }
  .k { margin-bottom: 6px; }
  .cta { margin-top: 8px; padding: 7px 16px; }
  .chrome--bl { display: none; }
}

/* 减弱动效：全部静态，只保留第一幕 */
@media (prefers-reduced-motion: reduce) {
  .beat { transition: none; }
  .beat__media img,
  .beat.is-active .beat__media img { transform: none; transition: opacity .3s; }
  .k, .t, .s, .d, .cta, .beat__n { transition: none; }
  .k i { transition: none; }
  .bn__grain, .beat__scan::after, .brand i { animation: none; }
  .bn__grain { opacity: .07; }
}
