.bg {
  position: fixed;
  inset: 0;
  background: #0d0d14;
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  z-index: 0;
  overflow: hidden;
}

.pattern-bg {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: #0d0d14;
}

/* 渐变光球 */
.ambient-orbs {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0;
  animation: orbIn 2.5s ease forwards;
  will-change: opacity, transform;
}

.orb-1 {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.28) 0%, transparent 70%);
  top: -280px;
  left: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.18) 0%, transparent 70%);
  bottom: -200px;
  right: -150px;
  animation-delay: 0.6s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.12) 0%, transparent 70%);
  top: 30%;
  right: 10%;
  animation-delay: 1.2s;
}

.orb-4 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.15) 0%, transparent 70%);
  bottom: 20%;
  left: 20%;
  animation-delay: 1.8s;
}

@keyframes orbIn {
  0% { opacity: 0; transform: scale(0.8); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

/* 网格线 */
.grid-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 30%, transparent 100%);
}

/* 噪点 */
.noise-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* 淡出 */
.bg-fade-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 25%;
  z-index: 2;
  background: linear-gradient(to bottom, transparent, #0d0d14);
  pointer-events: none;
}

.bg-fade-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 12%;
  z-index: 2;
  background: linear-gradient(to bottom, #0d0d14, transparent);
  pointer-events: none;
}

.cube-svg {
  position: absolute;
  width: 200%;
  height: 200%;
  left: -35%;
  top: -25%;
  background: transparent;
  opacity: 0.45;
  z-index: 1;
  animation: bgFloat 25s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes bgFloat {
  0%   { transform: translateY(0) rotate(0deg) scale(1); }
  40%  { transform: translateY(-6%) rotate(0.6deg) scale(1.025); }
  100% { transform: translateY(-3%) rotate(-0.4deg) scale(1.01); }
}

.bg-blur {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(13, 13, 20, 0.35);
  pointer-events: none;
}

@keyframes cubeMove {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-20%) scale(1.02) rotate(1deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cube-svg, .orb, .ambient-orbs { animation: none !important; }
  .cube-svg { opacity: 0.25; }
}
