/* ============================================
   兼容性降级 + 3 档动效选择 · fx-compat.css
   v2026-09-04-3
   - @supports 检测现代特性
   - 兜底静态背景(老内核)
   - .fx-mode-full / .fx-mode-reduced / .fx-mode-off 三档
   ============================================ */

/* ===== 老内核降级(默认开) ===== */
.fx-neon::before {
  display: none;  /* 默认隐藏霓虹边框(老内核可能渲染为白边) */
}
.fx-aurora-ring {
  display: none;  /* 默认隐藏旋转环(IE 不支持 conic-gradient) */
}
.fx-shine-v2 {
  /* 兜底:如果 background-clip: text 不支持,显示普通白 */
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.fx-shine-soft {
  color: #C9D0E0;
  -webkit-text-fill-color: #C9D0E0;
}

/* ===== 现代浏览器(feature query 命中) ===== */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .fx-shine-v2 {
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
  .fx-shine-soft {
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}
@supports (conic-gradient(#000, #fff)) {
  .fx-neon::before {
    display: block;
  }
  .fx-aurora-ring {
    display: block;
  }
}

/* ===== 3 档动效选择(由 body class 控制) ===== */

/* 全开 — 显式列每个 animation 覆盖 reduced-motion */
body.fx-mode-full .fx-shine-v2 { animation: fxShineV2 2.5s linear infinite !important; }
body.fx-mode-full .fx-shine-soft { animation: fxShineV2 3.5s linear infinite !important; }
body.fx-mode-full .fx-aurora::before { animation: auroraSlide 4.5s linear infinite !important; }
body.fx-mode-full .fx-aurora::after { animation: auroraSlide 5.5s linear infinite reverse !important; }
body.fx-mode-full .fx-aurora-glow { animation: auroraPulse 2.5s ease-in-out infinite !important; }
body.fx-mode-full .fx-aurora-ring { animation: ringRotate 8s linear infinite !important; }
body.fx-mode-full .fx-shine-v2::after { animation: cursorBlink 0.9s step-end infinite !important; display: inline-block !important; }
body.fx-mode-full .hero-lead::after { animation: cursorBlink 0.9s step-end infinite !important; display: block !important; }
body.fx-mode-full .btn-primary { animation: btnBreathe 2.5s ease-in-out infinite !important; }
body.fx-mode-full .stat::before { animation: pingDot 1.5s ease-out infinite !important; display: block !important; }
body.fx-mode-full .hero-badge { animation: badgeFlash 4s ease-in-out infinite !important; }
body.fx-mode-full .stat-num { animation: numGlow 2s ease-in-out infinite !important; }
body.fx-mode-full .fx-marquee-track { animation: marqueeScroll 22s linear infinite !important; }
body.fx-mode-full .fx-neon::before { animation: neonSpin 3s linear infinite !important; display: block !important; }
body.fx-mode-full .fx-shine { animation: fxShine 3.2s linear infinite !important; }
body.fx-mode-full .fx-glitch::before { animation: fxGlitchA 5s infinite !important; }
body.fx-mode-full .fx-glitch::after { animation: fxGlitchB 5s infinite !important; }
body.fx-mode-full .fx-particles { display: block; }

/* 减少模式 — 关闭持续动效,保留入场 */
body.fx-mode-reduced .fx-shine-v2,
body.fx-mode-reduced .fx-shine-soft,
body.fx-mode-reduced .fx-aurora::before,
body.fx-mode-reduced .fx-aurora::after,
body.fx-mode-reduced .fx-aurora-glow,
body.fx-mode-reduced .fx-aurora-ring,
body.fx-mode-reduced .fx-shine-v2::after,
body.fx-mode-reduced .hero-lead::after,
body.fx-mode-reduced .btn-primary,
body.fx-mode-reduced .stat::before,
body.fx-mode-reduced .hero-badge,
body.fx-mode-reduced .stat-num,
body.fx-mode-reduced .fx-marquee-track {
  animation: none !important;
}
body.fx-mode-reduced .fx-shine-v2,
body.fx-mode-reduced .fx-shine-soft {
  /* 但保留多色静态渐变(看起来"活"但不闪烁) */
  background: linear-gradient(90deg, #00B4FF 0%, #FFFFFF 50%, #E60012 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.fx-mode-reduced .fx-particles,
body.fx-mode-reduced .fx-tilt {
  display: none;
}

/* 全部关闭 — 完全静态 */
body.fx-mode-off .fx-shine-v2,
body.fx-mode-off .fx-shine-soft,
body.fx-mode-off .fx-aurora::before,
body.fx-mode-off .fx-aurora::after,
body.fx-mode-off .fx-aurora-glow,
body.fx-mode-off .fx-aurora-ring,
body.fx-mode-off .fx-shine-v2::after,
body.fx-mode-off .hero-lead::after,
body.fx-mode-off .btn-primary,
body.fx-mode-off .stat::before,
body.fx-mode-off .hero-badge,
body.fx-mode-off .stat-num,
body.fx-mode-off .fx-marquee-track,
body.fx-mode-off .fx-particles,
body.fx-mode-off .fx-tilt {
  animation: none !important;
}
body.fx-mode-off .fx-shine-v2,
body.fx-mode-off .fx-shine-soft {
  color: #fff;
  -webkit-text-fill-color: #fff;
}
body.fx-mode-off .fx-shine-v2::after,
body.fx-mode-off .hero-lead::after,
body.fx-mode-off .fx-aurora-ring,
body.fx-mode-off .stat::before {
  display: none !important;
}

/* ===== 首次访问引导 toast ===== */
.fx-mode-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(15, 17, 22, 0.95);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  display: none;
  max-width: 90%;
  align-items: center;
  gap: 16px;
  animation: toastIn 0.5s ease-out;
}
.fx-mode-toast.is-show {
  display: flex;
}
.fx-mode-toast .toast-text {
  flex: 1;
  min-width: 0;
}
.fx-mode-toast .toast-text strong {
  color: var(--accent);
}
.fx-mode-toast .toast-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.fx-mode-toast button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.fx-mode-toast button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.fx-mode-toast button.primary {
  background: var(--grad-accent);
  border-color: transparent;
  color: #fff;
}
.fx-mode-toast button.primary:hover {
  filter: brightness(1.1);
}
.fx-mode-toast .toast-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 移动端 toast 适配 */
@media (max-width: 600px) {
  .fx-mode-toast {
    flex-direction: column;
    align-items: stretch;
    bottom: 12px;
    padding: 14px;
  }
  .fx-mode-toast .toast-buttons {
    justify-content: flex-end;
  }
}

/* ============================================
   v2026-09-04-17 · 首次访问启动覆盖层(姚工"默认开启声音"要求)
   - Chrome 2022+ autoplay policy 必须 user gesture
   - 解决:首次访问显示"开始体验"按钮 → click 触发 user gesture → 解锁 audio
   - 第二次访问(localStorage fx-visited=1)不显示
   ============================================ */
.fx-start-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: rgba(15, 17, 22, 0.0);
}
.fx-start-overlay.is-show {
  opacity: 1;
}
.fx-start-overlay.is-leaving {
  opacity: 0;
  pointer-events: none;
}
.fx-start-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 180, 255, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(230, 0, 18, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.10) 0%, transparent 60%),
    linear-gradient(135deg, #0F1116 0%, #14171F 100%);
  backdrop-filter: blur(0px);
  transition: backdrop-filter 0.6s ease;
}
.fx-start-overlay.is-show .fx-start-bg {
  backdrop-filter: blur(20px);
}
.fx-start-content {
  position: relative;
  text-align: center;
  padding: 40px 32px;
  max-width: 520px;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.fx-start-overlay.is-show .fx-start-content {
  transform: translateY(0) scale(1);
}
.fx-start-logo {
  width: 128px;
  height: 128px;
  margin: 0 auto 24px;
  display: block;          /* video / img 元素都需要 */
  border-radius: 24px;
  /* 视频铺满容器,防 letterbox 拉伸 */
  object-fit: cover;
  /* 视频自身带红色 YG 动画,容器加红色光晕衬托 */
  box-shadow:
    0 8px 32px rgba(230, 0, 18, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 0 60px rgba(230, 0, 18, 0.20);
  animation: fxStartLogoPulse 2.5s ease-in-out infinite;
  /* 优化渲染:提示浏览器这个元素会变 transform */
  will-change: transform, box-shadow;
}
/* reduced / off 模式:停止视频播放 + 简化(只保留 scale) */
body.fx-mode-reduced .fx-start-logo,
body.fx-mode-off .fx-start-logo {
  animation: fxStartLogoPulseReduced 2.5s ease-in-out infinite;
}
@keyframes fxStartLogoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(230, 0, 18, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.10) inset, 0 0 60px rgba(230, 0, 18, 0.20); }
  50%      { transform: scale(1.05); box-shadow: 0 12px 40px rgba(230, 0, 18, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 80px rgba(230, 0, 18, 0.30); }
}
@keyframes fxStartLogoPulseReduced {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}
.fx-start-title {
  font-size: 42px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #FFFFFF 0%, #B8BCC4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.fx-start-subtitle {
  font-size: 15px;
  color: #B8BCC4;
  margin-bottom: 36px;
  letter-spacing: 0.02em;
}
.fx-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #00B4FF 0%, #00D4FF 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 100px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 8px 24px rgba(0, 180, 255, 0.40),
    0 0 0 1px rgba(255, 255, 255, 0.20) inset;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.fx-start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.30) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: fxStartBtnShine 2.5s ease-in-out infinite;
}
@keyframes fxStartBtnShine {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.fx-start-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 12px 32px rgba(0, 180, 255, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.30) inset;
}
.fx-start-btn:active {
  transform: translateY(0) scale(0.98);
}
.fx-start-btn-icon {
  font-size: 20px;
  animation: fxStartIconWiggle 1.2s ease-in-out infinite;
}
@keyframes fxStartIconWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-15deg); }
  75%      { transform: rotate(15deg); }
}
.fx-start-btn-arrow {
  font-size: 20px;
  transition: transform 0.2s ease;
}
.fx-start-btn:hover .fx-start-btn-arrow {
  transform: translateX(4px);
}
.fx-start-hint {
  margin-top: 28px;
  font-size: 12px;
  color: #6E7280;
  letter-spacing: 0.04em;
}
.fx-locked {
  overflow: hidden;
}
.fx-locked .fx-mode-indicator,
.fx-locked .fx-mute {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.fx-start-overlay.is-leaving ~ * .fx-mode-indicator,
.fx-start-overlay.is-leaving ~ * .fx-mute {
  opacity: 1;
}
/* 移动端 */
@media (max-width: 600px) {
  .fx-start-logo { width: 96px; height: 96px; border-radius: 20px; }
  .fx-start-title { font-size: 32px; }
  .fx-start-subtitle { font-size: 13px; }
  .fx-start-btn { padding: 14px 24px; font-size: 15px; }
}
