/* namefx v3 —— 用户名外观包（动效 + 字体一体）
 * key 白名单与 namefx-plugin/index.js / shop-plugin/model.js 同步：
 * neon-pink / rainbow / matrix / glitch / fire / electric / aurora / red-pulse
 * 站点默认深色主题（theme--dark）下为完整效果；浅色主题自动降级为深色字弱辉光。
 *
 * v3 变更：选择器三连提权 .nfx-x.nfx-x.nfx-x（specificity 0,3,0）。
 * 原因：主题 CSS 有 `.theme--dark a{color:#bdbdbd}`（0,1,1）与 `:visited/:hover`（0,2,1），
 * 单类规则（0,1,0）的 color 全被涂灰 —— 外观只剩辉光没有颜色（排行榜等 a 链接场景全中）。
 * 不能用 !important：cascade 中 important 作者声明 > 动画声明，会压死
 * nfx-alarm/nfx-zap/nfx-glitch 等动画里的 color/text-shadow 帧（脉冲/电弧/故障的核心动效）。
 * 三连选择器超过 (0,2,1)，普通声明仍被动画帧正常覆盖。
 */

/* 霓虹：经典灯管效果 —— 白芯 + 锐利粉辉光 + 灯管闪烁 */
.nfx-neon-pink.nfx-neon-pink.nfx-neon-pink {
  color: #ffd6f5;
  text-shadow: 0 0 2px #fff, 0 0 6px #ff2ec4, 0 0 12px #ff2ec4, 0 0 22px #e0219e;
  animation: nfx-flicker 3.2s steps(1) infinite;
}
.nfx-rainbow.nfx-rainbow.nfx-rainbow {
  color: #ff4d4d;
  text-shadow: 0 0 10px currentColor;
  animation: nfx-hue 4s linear infinite;
}
.nfx-matrix.nfx-matrix.nfx-matrix {
  color: #00ff41;
  text-shadow: 0 0 6px #00ff41, 0 0 14px #008f11;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  animation: nfx-flicker 3.2s steps(1) infinite;
}
.nfx-glitch.nfx-glitch.nfx-glitch {
  color: #e6e6e6;
  text-shadow: 2px 0 #ff004c, -2px 0 #00fff9;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  animation: nfx-glitch 2.8s steps(1) infinite;
}
.nfx-fire.nfx-fire.nfx-fire {
  background: linear-gradient(180deg, #ffeb3b, #ff9800 45%, #f44336 85%);
  background-size: 100% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 5px rgba(255, 120, 0, 0.45));
  font-family: KaiTi, "Kaiti SC", STKaiti, serif;
  animation: nfx-fire 1.4s ease-in-out infinite alternate;
}
.nfx-electric.nfx-electric.nfx-electric {
  color: #e9d5ff;
  text-shadow: 0 0 4px #c084fc, 0 0 12px #a855f7, 0 0 24px #7c3aed;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  animation: nfx-zap 2.2s steps(1) infinite;
}
.nfx-aurora.nfx-aurora.nfx-aurora {
  background: linear-gradient(100deg, #34d399, #8b5cf6 45%, #34d399 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.35));
  animation: nfx-shine 3.2s linear infinite;
}
.nfx-red-pulse.nfx-red-pulse.nfx-red-pulse {
  color: #ffb4b0;
  text-shadow: 0 0 6px #ff3b30, 0 0 14px #ff3b30;
  animation: nfx-alarm 1.6s ease-in-out infinite;
}

@keyframes nfx-pulse {
  50% { text-shadow: 0 0 5px #ff2ec4, 0 0 18px #ff2ec4, 0 0 44px #7b2ff7; }
}
@keyframes nfx-hue {
  to { filter: hue-rotate(360deg); }
}
@keyframes nfx-flicker {
  0%, 100% { opacity: 1; }
  6% { opacity: 0.55; }
  7% { opacity: 1; }
  41% { opacity: 0.8; }
  42% { opacity: 1; }
  69% { opacity: 0.6; }
  70% { opacity: 1; }
}
@keyframes nfx-glitch {
  0%, 84%, 100% { text-shadow: 2px 0 #ff004c, -2px 0 #00fff9; transform: none; }
  85% { text-shadow: -3px 0 #ff004c, 3px 0 #00fff9; transform: skewX(-5deg) translateY(1px); }
  88% { text-shadow: 3px 0 #ff004c, -3px 0 #00fff9; transform: skewX(4deg); }
  92% { text-shadow: 1px 0 #ff004c, -1px 0 #00fff9; transform: none; }
}
@keyframes nfx-fire {
  from { background-position: 50% 0; }
  to { background-position: 50% 100%; }
}
@keyframes nfx-zap {
  0%, 100% { opacity: 1; text-shadow: 0 0 4px #c084fc, 0 0 12px #a855f7; }
  9% { opacity: 0.4; text-shadow: 0 0 2px #c084fc; }
  10% { opacity: 1; text-shadow: 0 0 9px #d8b4fe, 0 0 20px #a855f7; }
  47% { opacity: 0.85; text-shadow: 0 0 4px #c084fc; }
  48% { opacity: 1; text-shadow: 0 0 3px #c084fc, 0 0 9px #a855f7; }
  78% { opacity: 0.5; }
  79% { opacity: 1; text-shadow: 0 0 6px #c084fc, 0 0 16px #7c3aed; }
}
@keyframes nfx-shine {
  to { background-position: -220% 0; }
}
@keyframes nfx-alarm {
  0%, 100% { text-shadow: 0 0 4px #ff3b30; color: #ffb4b0; }
  50% { text-shadow: 0 0 10px #ff3b30, 0 0 26px #dc2626; color: #ffd6d3; }
}

/* 浅色主题降级：深色字 + 弱辉光，保证对比度（同样三连提权） */
html:not(.theme--dark) .nfx-neon-pink.nfx-neon-pink {
  color: #c2185b;
  text-shadow: 0 0 6px rgba(255, 46, 196, 0.25);
}
html:not(.theme--dark) .nfx-matrix.nfx-matrix {
  color: #008f11;
  text-shadow: none;
}
html:not(.theme--dark) .nfx-glitch.nfx-glitch {
  color: #444444;
  text-shadow: 1px 0 rgba(255, 0, 76, 0.45), -1px 0 rgba(0, 255, 249, 0.45);
}
html:not(.theme--dark) .nfx-electric.nfx-electric {
  color: #6d28d9;
  text-shadow: 0 0 6px rgba(168, 85, 247, 0.3);
}
html:not(.theme--dark) .nfx-red-pulse.nfx-red-pulse {
  color: #c62828;
  text-shadow: none;
  animation-name: nfx-alarm-light;
}
/* fire / aurora 用 background-image 而非 background 简写：
   简写会把 background-clip 重置回 border-box，文字（color:transparent）直接隐形 */
html:not(.theme--dark) .nfx-fire.nfx-fire {
  background-image: linear-gradient(180deg, #e65100, #c62828 55%, #8e0000 90%);
  background-size: 100% 220%;
  filter: none;
}
html:not(.theme--dark) .nfx-aurora.nfx-aurora {
  background-image: linear-gradient(100deg, #047857, #6d28d9 45%, #047857 90%);
  background-size: 220% 100%;
  filter: none;
}

/* 浅色下赤色脉冲的专用动画：深红明暗脉动（原 nfx-alarm 的浅粉 color 帧在白底上看不清） */
@keyframes nfx-alarm-light {
  0%, 100% { color: #c62828; }
  50% { color: #7f0000; }
}

/* 减弱动态偏好：停动画，保留静态配色 */
@media (prefers-reduced-motion: reduce) {
  .nfx-neon-pink, .nfx-rainbow, .nfx-matrix, .nfx-glitch,
  .nfx-fire, .nfx-electric, .nfx-aurora, .nfx-red-pulse {
    animation: none !important;
  }
}
