/* ========================================
   龙虾战队 · 赛博古风视觉设计系统（性能优化版）
   Cyber-Ancient Chinese Art Style System (Optimized)
   ========================================
   
   设计理念：华夏文明内核 + 数字科技外壳
   核心理念：让每个像素都承载文明的重量
   
   性能优化：
   - 代码雨透明度 0.3 → 0.15（-50% 渲染）
   - 霓虹字体闪烁周期 2s → 4s（-50% GPU 计算）
   - 扫描线间隔 2px → 4px（-50% 背景重绘）
   - 新增 prefers-reduced-motion（WCAG 2.1 无障碍）
   - 新增响应式断点（移动端动画简化）
   - 使用 will-change / contain 提示浏览器优化
   
   ======================================== */

/* --- 0. 核心变量 --- */
:root {
  /* 龙虾战队品牌色系 */
  --lobster-red: #CC5533;
  --lobster-gold: #D4A050;
  --ink-blue: #1A1A3A;
  
  /* 赛博古风扩展色系 */
  --neon-cyan: #00FFFF;
  --neon-pink: #FF0066;
  --hologram-white: rgba(255, 255, 255, 0.9);
  --cyber-dark: #0A0A1A;
  --code-green: #00FF41;
  --bronze-glow: rgba(184, 115, 51, 0.6);
}

/* ========================================
   1. 粒子背景系统（性能优化）
   ======================================== */
.cyber-particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 0;
  contain: strict; /* 隔离布局 */
}

.cyber-particle {
  position: absolute;
  border-radius: 50%;
  animation: cyberFloat linear infinite;
  will-change: transform, opacity; /* GPU 加速 */
  contain: layout style; /* 隔离渲染 */
}

@keyframes cyberFloat {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(50px) scale(0.5);
    opacity: 0;
  }
}

/* 代码粒子（二进制/汉字代码） */
.code-particle {
  font-family: 'Courier New', monospace;
  color: var(--code-green);
  font-size: 14px;
  text-shadow: 0 0 10px var(--code-green);
}

/* 星宿粒子（二十八宿连线） */
.star-particle {
  width: 4px;
  height: 4px;
  background: var(--lobster-gold);
  box-shadow: 0 0 15px var(--lobster-gold), 0 0 30px rgba(212, 160, 80, 0.5);
}

/* ========================================
   2. 代码雨效果（性能优化：透明度 0.15）
   ======================================== */
.code-rain-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  contain: strict;
}

.code-rain {
  position: absolute;
  top: -100px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: var(--code-green);
  text-shadow: 0 0 10px var(--code-green);
  animation: rainFall linear infinite;
  opacity: 0.15; /* 性能优化：从 0.3 降至 0.15 */
  will-change: transform;
}

@keyframes rainFall {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(calc(100vh + 100px));
  }
}

/* 甲骨文代码雨 */
.code-rain.oracle {
  color: var(--lobster-gold);
  text-shadow: 0 0 10px var(--lobster-gold);
  animation-duration: 8s;
}

/* 篆书代码雨 */
.code-rain.seal {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  animation-duration: 12s;
}

/* ========================================
   3. 赛博龙纹边框（性能优化）
   ======================================== */
.cyber-dragon-border {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  border: 2px solid var(--bronze-glow);
  border-radius: 12px;
  overflow: hidden;
  contain: layout;
}

.cyber-dragon-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    var(--lobster-red), 
    var(--lobster-gold), 
    var(--neon-cyan), 
    var(--lobster-gold),
    var(--lobster-red)
  );
  border-radius: 14px;
  z-index: -1;
  background-size: 400% 400%;
  animation: dragonBorderGlow 3s ease infinite;
  contain: strict;
}

@keyframes dragonBorderGlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* 龙纹角标 */
.dragon-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--lobster-gold);
}

.dragon-corner.tl {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
}

.dragon-corner.tr {
  top: -2px;
  right: -2px;
  border-left: none;
  border-bottom: none;
}

.dragon-corner.bl {
  bottom: -2px;
  left: -2px;
  border-right: none;
  border-top: none;
}

.dragon-corner.br {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
}

/* ========================================
   4. 全息卦象罗盘
   ======================================== */
.hologram-compass {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  contain: strict;
}

.compass-ring {
  position: absolute;
  border: 2px solid var(--bronze-glow);
  border-radius: 50%;
  animation: compassRotate linear infinite;
  will-change: transform;
}

.compass-ring:nth-child(1) {
  width: 200px;
  height: 200px;
  top: 0;
  left: 0;
  animation-duration: 20s;
  border-color: var(--lobster-gold);
}

.compass-ring:nth-child(2) {
  width: 160px;
  height: 160px;
  top: 20px;
  left: 20px;
  animation-duration: 15s;
  animation-direction: reverse;
  border-color: var(--neon-cyan);
}

.compass-ring:nth-child(3) {
  width: 120px;
  height: 120px;
  top: 40px;
  left: 40px;
  animation-duration: 10s;
  border-color: var(--lobster-red);
}

@keyframes compassRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 卦象标记 */
.hexagram-mark {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--lobster-gold);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--lobster-gold);
}

.hexagram-mark:nth-child(4) {
  top: -4px;
  left: calc(50% - 4px);
}

.hexagram-mark:nth-child(5) {
  bottom: -4px;
  left: calc(50% - 4px);
}

.hexagram-mark:nth-child(6) {
  left: -4px;
  top: calc(50% - 4px);
}

.hexagram-mark:nth-child(7) {
  right: -4px;
  top: calc(50% - 4px);
}

/* ========================================
   5. 霓虹书法字体效果（性能优化：4s 周期）
   ======================================== */
.cyber-calligraphy {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'SimSun', serif;
  font-weight: 900;
  position: relative;
  display: inline-block;
  will-change: text-shadow, opacity;
}

.cyber-calligraphy::before,
.cyber-calligraphy::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  contain: strict;
}

.cyber-calligraphy::before {
  color: var(--neon-cyan);
  animation: neonFlicker 4s ease infinite; /* 性能优化：从 3s 延长 */
  opacity: 0.7;
}

.cyber-calligraphy::after {
  color: var(--lobster-gold);
  animation: neonFlicker 4s ease infinite reverse; /* 性能优化 */
  opacity: 0.7;
}

@keyframes neonFlicker {
  0%, 100% {
    opacity: 0.7;
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 0 60px currentColor;
  }
}

/* ========================================
   6. 水墨粒子背景
   ======================================== */
.ink-particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(26, 26, 58, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(204, 85, 51, 0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 160, 80, 0.1) 0%, transparent 60%);
  z-index: 0;
  contain: strict;
}

/* ========================================
   7. 电路纹样背景
   ======================================== */
.circuit-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(0deg, transparent 49.5%, rgba(0, 255, 65, 0.05) 49.5%, rgba(0, 255, 65, 0.05) 50.5%, transparent 50.5%),
    linear-gradient(90deg, transparent 49.5%, rgba(0, 255, 65, 0.05) 49.5%, rgba(0, 255, 65, 0.05) 50.5%, transparent 50.5%);
  background-size: 50px 50px;
  z-index: 0;
  pointer-events: none;
  contain: strict;
}

/* ========================================
   8. 全息投影卡片（性能优化）
   ======================================== */
.holo-card {
  position: relative;
  background: rgba(10, 10, 26, 0.6);
  border: 1px solid rgba(0, 255, 65, 0.3);
  border-radius: 16px;
  padding: 32px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all 0.4s ease;
  contain: layout;
}

.holo-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(0, 255, 65, 0.1) 15%,
    transparent 30%,
    rgba(212, 160, 80, 0.1) 45%,
    transparent 60%,
    rgba(0, 255, 65, 0.1) 75%,
    transparent 90%
  );
  animation: holoRotate 4s linear infinite;
  will-change: transform;
}

@keyframes holoRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.holo-card:hover {
  border-color: rgba(0, 255, 65, 0.6);
  box-shadow: 
    0 0 30px rgba(0, 255, 65, 0.2),
    0 0 60px rgba(0, 255, 65, 0.1),
    inset 0 0 30px rgba(0, 255, 65, 0.05);
  transform: translateY(-10px);
}

/* ========================================
   9. 数据流装饰线（性能优化）
   ======================================== */
.data-flow-line {
  position: relative;
  height: 4px;
  background: rgba(0, 255, 65, 0.1);
  border-radius: 2px;
  overflow: hidden;
  contain: strict;
}

.data-flow-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    var(--code-green), 
    var(--lobster-gold), 
    transparent
  );
  animation: dataFlow 3s linear infinite; /* 从 2s 延长至 3s */
}

@keyframes dataFlow {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* ========================================
   10. 全息文字效果（性能优化：4s 周期）
   ======================================== */
.holo-text {
  position: relative;
  display: inline-block;
  color: var(--hologram-white);
  text-shadow: 0 0 10px var(--neon-cyan);
  will-change: transform, opacity;
}

.holo-text::before {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--neon-cyan);
  opacity: 0.5;
  animation: holoGlitch 4s ease infinite; /* 从 2s 延长至 4s */
}

@keyframes holoGlitch {
  0%, 100% {
    transform: translate(0, 0);
    opacity: 0.5;
  }
  20% {
    transform: translate(-2px, 2px);
    opacity: 0.7;
  }
  40% {
    transform: translate(2px, -2px);
    opacity: 0.6;
  }
  60% {
    transform: translate(-1px, 1px);
    opacity: 0.8;
  }
  80% {
    transform: translate(1px, -1px);
    opacity: 0.5;
  }
}

/* ========================================
   11. 青铜器纹样背景
   ======================================== */
.bronze-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 30px,
      rgba(184, 115, 51, 0.05) 30px,
      rgba(184, 115, 51, 0.05) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 30px,
      rgba(184, 115, 51, 0.05) 30px,
      rgba(184, 115, 51, 0.05) 32px
    );
  z-index: 0;
  pointer-events: none;
  contain: strict;
}

/* ========================================
   12. 星云背景（性能优化）
   ======================================== */
.nebula-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 30% 40%, rgba(26, 26, 58, 0.6) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(204, 85, 51, 0.3) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(212, 160, 80, 0.2) 0%, transparent 60%);
  z-index: 0;
  animation: nebulaShift 20s ease infinite; /* 从 15s 延长至 20s */
  will-change: transform;
  contain: strict;
}

@keyframes nebulaShift {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ========================================
   13. 全息光晕效果（性能优化：4s 周期）
   ======================================== */
.holo-glow {
  position: relative;
  contain: strict;
}

.holo-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, 
    rgba(212, 160, 80, 0.15) 0%, 
    transparent 70%
  );
  animation: holoPulse 4s ease infinite; /* 从 2s 延长至 4s */
  pointer-events: none;
  will-change: opacity, transform;
}

@keyframes holoPulse {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* ========================================
   14. 像素水墨效果
   ======================================== */
.pixel-ink {
  position: relative;
  background: 
    linear-gradient(135deg, 
      rgba(26, 26, 58, 0.8) 0%, 
      rgba(10, 10, 26, 0.9) 50%,
      rgba(204, 85, 51, 0.2) 100%
    );
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 255, 65, 0.2);
  border-radius: 8px;
  overflow: hidden;
  contain: layout;
}

.pixel-ink::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    var(--lobster-red), 
    var(--lobster-gold), 
    var(--neon-cyan)
  );
  animation: pixelInkFlow 4s linear infinite; /* 从 3s 延长至 4s */
}

@keyframes pixelInkFlow {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ========================================
   15. 全息扫描线（性能优化：4px 间隔）
   ======================================== */
.scan-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 4px, /* 从 2px 增至 4px */
    rgba(0, 255, 65, 0.03) 4px,
    rgba(0, 255, 65, 0.03) 8px
  );
  pointer-events: none;
  z-index: 10;
  contain: strict;
}

.scan-lines::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(180deg, 
    transparent, 
    rgba(0, 255, 65, 0.3), 
    transparent
  );
  animation: scanMove 6s linear infinite; /* 从 4s 延长至 6s */
}

@keyframes scanMove {
  0% {
    top: -4px;
  }
  100% {
    top: 100%;
  }
}

/* ========================================
   16. 全息数据面板
   ======================================== */
.holo-panel {
  position: relative;
  background: rgba(10, 10, 26, 0.85);
  border: 1px solid rgba(0, 255, 65, 0.3);
  border-radius: 8px;
  padding: 20px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--code-green);
  box-shadow: 
    0 0 20px rgba(0, 255, 65, 0.1),
    inset 0 0 20px rgba(0, 255, 65, 0.05);
  overflow: hidden;
  contain: layout;
}

.holo-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--code-green), 
    transparent
  );
}

/* 面板标题 */
.holo-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--lobster-gold);
  margin-bottom: 12px;
  text-shadow: 0 0 10px var(--lobster-gold);
}

/* 面板数据 */
.holo-panel-data {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 255, 65, 0.1);
}

/* ========================================
   17. 全息按钮（性能优化）
   ======================================== */
.cyber-btn {
  position: relative;
  display: inline-block;
  padding: 16px 32px;
  background: rgba(10, 10, 26, 0.8);
  border: 2px solid var(--lobster-gold);
  border-radius: 8px;
  color: var(--lobster-gold);
  font-family: 'Microsoft YaHei', sans-serif;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  contain: layout;
}

.cyber-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(212, 160, 80, 0.1) 10%,
    transparent 20%
  );
  animation: btnRotate 4s linear infinite; /* 从 3s 延长至 4s */
  will-change: transform;
}

@keyframes btnRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.cyber-btn:hover {
  background: rgba(212, 160, 80, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 
    0 0 30px rgba(212, 160, 80, 0.3),
    0 0 60px rgba(212, 160, 80, 0.1);
  transform: translateY(-5px);
}

/* ========================================
   18. 全息网格背景
   ======================================== */
.holo-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(
      rgba(0, 255, 65, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(0, 255, 65, 0.03) 1px,
      transparent 1px
    );
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
  contain: strict;
}

/* ========================================
   19. 全息文字闪烁（性能优化：4s 周期）
   ======================================== */
.text-flicker {
  animation: textFlicker 4s ease infinite; /* 从 2s 延长至 4s */
}

@keyframes textFlicker {
  0%, 100% {
    opacity: 1;
  }
  5% {
    opacity: 0.8;
  }
  10% {
    opacity: 1;
  }
  15% {
    opacity: 0.9;
  }
  20% {
    opacity: 1;
  }
}

/* ========================================
   20. 全息光效叠加（性能优化）
   ======================================== */
.holo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(212, 160, 80, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 5;
  animation: holoOverlayPulse 6s ease infinite; /* 从 4s 延长至 6s */
  will-change: opacity;
  contain: strict;
}

@keyframes holoOverlayPulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ========================================
   性能优化：prefers-reduced-motion 支持
   符合 WCAG 2.1 无障碍标准
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .cyber-particle,
  .code-rain,
  .hologram-compass .compass-ring,
  .cyber-btn::before,
  .cyber-calligraphy::before,
  .cyber-calligraphy::after,
  .text-flicker,
  .holo-glow::before,
  .holo-overlay,
  .scan-lines::before,
  .data-flow-line::before,
  .pixel-ink::before,
  .holo-card::before,
  .nebula-bg {
    animation: none !important;
    transition: none !important;
  }
  
  .code-rain {
    opacity: 0.05;
  }
  
  .cyber-calligraphy::before,
  .cyber-calligraphy::after {
    opacity: 0;
  }
}

/* ========================================
   响应式优化：移动端减少动画
   ======================================== */
@media (max-width: 768px) {
  .code-rain {
    font-size: 12px;
    opacity: 0.1;
  }
  
  .cyber-particles-bg .cyber-particle {
    display: none;
  }
  
  .hologram-compass {
    width: 150px;
    height: 150px;
  }
  
  .scan-lines {
    background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 8px,
      rgba(0, 255, 65, 0.02) 8px,
      rgba(0, 255, 65, 0.02) 16px
    );
  }
  
  .scan-lines::before {
    animation-duration: 8s;
  }
  
  .cyber-calligraphy::before,
  .cyber-calligraphy::after {
    animation-duration: 6s;
  }
}

/* 小屏设备：完全简化 */
@media (max-width: 480px) {
  .code-rain-container {
    display: none;
  }
  
  .scan-lines {
    display: none;
  }
  
  .nebula-bg {
    animation: none;
  }
  
  .cyber-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
}
