.hero-hud {
  inset: 0;
  overflow: visible;
  perspective: 620px;
  perspective-origin: 50% 48%;
  pointer-events: none;
  position: absolute;
}

.hero-hud-back {
  z-index: 2;
}

.hero-hud-front {
  z-index: 4;
}

.hud-panel {
  background:
    linear-gradient(135deg, rgba(248, 248, 248, 0.2), rgba(248, 248, 248, 0.055) 48%, rgba(214, 40, 40, 0.08)),
    rgba(248, 248, 248, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow:
    0 0 0 1px rgba(214, 40, 40, 0.22),
    0 0 18px rgba(248, 248, 248, 0.16),
    0 0 30px rgba(214, 40, 40, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 0 28px rgba(214, 40, 40, 0.08);
  color: rgba(248, 248, 248, 0.88);
  overflow: hidden;
  position: absolute;
  text-transform: uppercase;
  transform-origin: center;
  transform-style: preserve-3d;
  -webkit-backdrop-filter: blur(5px) saturate(132%);
  backdrop-filter: blur(5px) saturate(132%);
}

.hud-panel::after {
  animation: hudSweep 7s ease-in-out infinite;
  background:
    linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.05) 38%, rgba(255, 255, 255, 0.3) 50%, rgba(214, 40, 40, 0.12) 58%, transparent 72%);
  content: "";
  inset: 0;
  opacity: 0.42;
  position: absolute;
  transform: translateX(-120%);
}

.page-home .hud-panel::before {
  animation: hudBorderTrace 1.08s ease-out both;
  background:
    linear-gradient(90deg, rgba(255, 77, 77, 0.92), rgba(255, 244, 244, 0.62)) left top / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(255, 244, 244, 0.62), rgba(255, 77, 77, 0.84)) right top / 1px 100% no-repeat,
    linear-gradient(270deg, rgba(255, 77, 77, 0.86), rgba(255, 244, 244, 0.44)) right bottom / 100% 1px no-repeat,
    linear-gradient(0deg, rgba(255, 244, 244, 0.46), rgba(255, 77, 77, 0.8)) left bottom / 1px 100% no-repeat;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.page-home .hud-code::before {
  animation-delay: 0.86s;
}

.page-home .hud-neural::before {
  animation-delay: 1.02s;
}

.page-home .hud-core-card::before {
  animation-delay: 1.16s;
}

.hud-neural {
  animation: hudFloatA 9s ease-in-out infinite alternate;
  height: 20%;
  left: 56%;
  padding: clamp(0.54rem, 0.72vw, 0.75rem);
  top: 39%;
  transform-origin: 32% 52%;
  width: 43%;
  z-index: 2;
}

.hud-code {
  animation: hudFloatB 10s ease-in-out infinite alternate;
  color: rgba(13, 13, 13, 0.82);
  left: -10%;
  padding: 0.9rem 1rem;
  top: 55%;
  transform-origin: 72% 52%;
  width: 42%;
  z-index: 1;
}

.hud-core-card {
  --battery-level: 0.64;
  --core-energy: rgba(214, 40, 40, 0.74);
  --core-glow: rgba(255, 77, 77, 0.42);
  --core-pulse-speed: 2.8s;
  --core-orbit-speed: 11s;
  animation: hudFloatC 11s ease-in-out infinite alternate;
  left: 43%;
  padding: 0.84rem 0.92rem 0.88rem;
  top: 62%;
  transform: translateX(8%);
  transform-origin: 50% 58%;
  width: 41%;
  z-index: 3;
}

.hud-core-card.is-charging {
  --core-energy: rgba(255, 244, 244, 0.96);
  --core-glow: rgba(255, 77, 77, 0.72);
  --core-pulse-speed: 1.45s;
  --core-orbit-speed: 6.8s;
}

.hud-core-card.is-low {
  --core-energy: rgba(214, 40, 40, 0.58);
  --core-glow: rgba(214, 40, 40, 0.22);
  --core-pulse-speed: 4.2s;
  --core-orbit-speed: 15s;
}

.page-home .hud-code {
  animation:
    hudFloatB 10s ease-in-out infinite alternate,
    hudCardOnline 0.72s ease-out 0.92s both;
}

.page-home .hud-neural {
  animation:
    hudFloatA 9s ease-in-out infinite alternate,
    hudCardOnline 0.76s ease-out 1.08s both;
}

.page-home .hud-core-card {
  animation:
    hudFloatC 11s ease-in-out infinite alternate,
    hudCardOnline 0.78s ease-out 1.22s both;
}

.hud-panel-title {
  color: rgba(248, 248, 248, 0.9);
  font-size: clamp(0.42rem, 0.46vw, 0.54rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 0;
  position: relative;
  text-shadow:
    0 0 8px rgba(248, 248, 248, 0.32),
    0 0 14px rgba(214, 40, 40, 0.24);
  z-index: 2;
}

.hud-micro,
.hud-code p {
  color: rgba(13, 13, 13, 0.72);
  font-size: clamp(0.36rem, 0.42vw, 0.48rem);
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.65;
  margin: 0.78rem 0 0;
  position: relative;
  z-index: 2;
}

.hud-micro strong,
.hud-code strong {
  color: #d62828;
  font-weight: 800;
}

.hud-log-line {
  display: inline-block;
  min-width: 14.5em;
  transition: color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.hud-log-line.is-changing {
  color: #d62828;
  opacity: 0.36;
  transform: translateY(-2px);
}

.hud-code .hud-panel-title {
  color: rgba(13, 13, 13, 0.84);
  text-shadow:
    0 0 8px rgba(248, 248, 248, 0.65),
    0 0 12px rgba(214, 40, 40, 0.14);
}

.hud-neural .hud-panel-title {
  color: #7f080d;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.28),
    0 0 13px rgba(214, 40, 40, 0.42);
}

.hud-neural-map {
  filter:
    drop-shadow(0 0 7px rgba(255, 45, 50, 0.78))
    drop-shadow(0 0 18px rgba(214, 40, 40, 0.38));
  height: 54%;
  left: 50%;
  overflow: visible;
  position: absolute;
  top: 34%;
  transform: translateX(-50%);
  width: 82%;
  z-index: 2;
}

.hud-neural-lightning {
  fill: none;
  opacity: 0;
  pointer-events: none;
  stroke: #fff9f4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 8px rgba(255, 48, 53, 0.9))
    drop-shadow(0 0 16px rgba(214, 40, 40, 0.58));
}

.hud-neural-lightning.is-active {
  animation: neuralLightningFlicker 92ms steps(2, end) infinite;
  opacity: 1;
}

.hud-neural-map line {
  animation: neuralLinePulse 4.8s ease-in-out infinite alternate;
  stroke: rgba(255, 58, 62, 0.54);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
}

.hud-neural-map circle {
  animation: neuralNodeDrift 5.6s ease-in-out infinite alternate;
  fill: #ff3035;
  stroke: rgba(255, 235, 235, 0.54);
  stroke-width: 0.5;
  transition:
    fill 70ms ease,
    filter 70ms ease,
    opacity 70ms ease,
    r 70ms ease,
    stroke 70ms ease,
    stroke-width 70ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.hud-neural-map .hud-core {
  animation: neuralCorePulse 2.9s ease-in-out infinite alternate;
  fill: #fff2f2;
  stroke: #ff262d;
  stroke-width: 1.5;
}

.hud-neural-map circle.is-struck,
.hud-neural-map circle.is-converted {
  fill: #fff9f4;
  opacity: 1;
  stroke: #ffffff;
  stroke-width: 1.05;
  filter:
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 12px rgba(255, 48, 53, 0.76))
    drop-shadow(0 0 22px rgba(214, 40, 40, 0.48));
}

.hud-neural-map circle.is-struck {
  r: 4.2;
}

.hud-neural-map circle:nth-of-type(2n) {
  animation-delay: -1.4s;
}

.hud-neural-map circle:nth-of-type(3n) {
  animation-delay: -2.5s;
}

.hud-neural-map line:nth-of-type(2n) {
  animation-delay: -1.6s;
}

.hud-neural-map line:nth-of-type(3n) {
  animation-delay: -2.8s;
}

.hud-metrics {
  bottom: 0.52rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, 1fr);
  left: 0.6rem;
  margin: 0;
  position: absolute;
  right: 0.6rem;
  z-index: 2;
}

.hud-metrics dt {
  color: rgba(248, 248, 248, 0.7);
  font-size: clamp(0.34rem, 0.38vw, 0.44rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
}

.hud-metrics dd {
  color: rgba(248, 248, 248, 0.92);
  font-size: clamp(0.62rem, 0.8vw, 0.92rem);
  line-height: 1;
  margin: 0;
  text-shadow: 0 0 12px rgba(214, 40, 40, 0.28);
}

.hud-metrics div:nth-child(2) dt,
.hud-metrics div:nth-child(2) dd {
  color: #0d0d0d;
  text-shadow:
    0 0 8px rgba(248, 248, 248, 0.62),
    0 0 12px rgba(214, 40, 40, 0.12);
}

.hud-corner {
  border-color: rgba(255, 77, 77, 0.76);
  height: 18px;
  position: absolute;
  width: 18px;
  z-index: 3;
}

.hud-corner-tl {
  border-left: 1px solid;
  border-top: 1px solid;
  left: -1px;
  top: -1px;
}

.hud-corner-br {
  border-bottom: 1px solid;
  border-right: 1px solid;
  bottom: -1px;
  right: -1px;
}

.hud-core-body {
  align-items: center;
  display: grid;
  gap: 0.76rem;
  grid-template-columns: 1fr auto;
  margin-top: 0.78rem;
  position: relative;
  z-index: 2;
}

.hud-core-readout {
  display: grid;
  gap: 0.36rem;
}

.hud-core-percent {
  color: rgba(255, 244, 244, 0.96);
  font-size: clamp(1.28rem, 2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.82;
  text-shadow:
    0 0 10px var(--core-glow),
    0 0 22px rgba(214, 40, 40, 0.34);
}

.hud-core-caption,
.hud-core-footer {
  color: rgba(255, 255, 255, 0.98);
  font-size: clamp(0.34rem, 0.4vw, 0.46rem);
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.7),
    0 0 16px rgba(214, 40, 40, 0.46),
    0 1px 2px rgba(13, 13, 13, 0.36);
}

.hud-core-reactor {
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  height: clamp(48px, 4.7vw, 68px);
  place-items: center;
  position: relative;
}

.hud-core-reactor::before {
  background:
    conic-gradient(from 0deg, transparent 0 22%, rgba(255, 244, 244, 0.9) 28%, rgba(214, 40, 40, 0.68) 36%, transparent 44% 100%);
  border-radius: inherit;
  content: "";
  inset: -3px;
  opacity: calc(0.28 + (var(--battery-level) * 0.54));
  position: absolute;
  transform: rotate(calc(var(--battery-level) * 270deg));
}

.hud-core-orbit {
  animation: coreOrbit var(--core-orbit-speed) linear infinite;
  border: 1px solid rgba(255, 77, 77, 0.42);
  border-left-color: var(--core-energy);
  border-radius: inherit;
  border-top-color: rgba(255, 244, 244, 0.68);
  inset: 0;
  position: absolute;
}

.hud-core-orbit-secondary {
  animation-direction: reverse;
  animation-duration: calc(var(--core-orbit-speed) * 1.38);
  border-bottom-color: rgba(255, 244, 244, 0.42);
  border-left-color: rgba(214, 40, 40, 0.22);
  inset: 8px;
}

.hud-core-pulse {
  animation: corePulse var(--core-pulse-speed) ease-in-out infinite;
  background:
    radial-gradient(circle, rgba(255, 244, 244, 0.95), var(--core-energy) 42%, rgba(214, 40, 40, 0.1) 70%, transparent 72%);
  border-radius: inherit;
  filter: drop-shadow(0 0 14px var(--core-glow));
  inset: 13px;
  position: absolute;
}

.hud-core-dot {
  background: #fff9f4;
  border-radius: inherit;
  box-shadow:
    0 0 7px rgba(255, 244, 244, 0.86),
    0 0 18px var(--core-glow);
  height: 7px;
  position: relative;
  width: 7px;
}

.hud-core-footer {
  align-items: center;
  display: grid;
  gap: 0.54rem;
  grid-template-columns: auto 1fr;
  margin-top: 0.8rem;
  position: relative;
  z-index: 2;
}

.hud-core-rail {
  background: rgba(13, 13, 13, 0.14);
  display: block;
  height: 1px;
  overflow: hidden;
  position: relative;
}

.hud-core-rail::before {
  background:
    linear-gradient(90deg, rgba(214, 40, 40, 0.24), var(--core-energy), rgba(255, 244, 244, 0.92));
  box-shadow: 0 0 12px var(--core-glow);
  content: "";
  inset: 0;
  position: absolute;
  transform: scaleX(var(--battery-level));
  transform-origin: left center;
}

.hud-core-card.is-low .hud-core-percent,
.hud-core-card.is-low .hud-core-footer,
.hud-core-card.is-low .hud-core-caption {
  color: #d62828;
}

.hud-core-card.is-charging .hud-core-percent {
  color: #fff9f4;
}

@keyframes hudFloatA {
  from {
    transform: translateZ(62px) rotateY(18deg) rotateX(4deg) translate3d(0, 0, 0);
  }

  to {
    transform: translateZ(62px) rotateY(18deg) rotateX(4deg) translate3d(-8px, -9px, 0);
  }
}

@keyframes hudFloatB {
  from {
    transform: translateZ(-54px) rotateY(-16deg) rotateX(3deg) translate3d(0, 6px, 0);
  }

  to {
    transform: translateZ(-54px) rotateY(-16deg) rotateX(3deg) translate3d(8px, -8px, 0);
  }
}

@keyframes hudFloatC {
  from {
    transform: translateX(8%) translateZ(88px) rotateX(2deg) translate3d(0, 0, 0);
  }

  to {
    transform: translateX(8%) translateZ(88px) rotateX(2deg) translate3d(0, -10px, 0);
  }
}

@keyframes hudCardOnline {
  from {
    filter: blur(5px) saturate(0.9);
    opacity: 0;
  }

  to {
    filter: blur(0) saturate(1);
    opacity: 1;
  }
}

@keyframes hudBorderTrace {
  0% {
    clip-path: inset(0 100% 100% 0);
    opacity: 0;
  }

  24% {
    clip-path: inset(0 0 100% 0);
    opacity: 0.9;
  }

  54% {
    clip-path: inset(0 0 0 96%);
    opacity: 1;
  }

  78% {
    clip-path: inset(96% 0 0 0);
    opacity: 0.92;
  }

  100% {
    clip-path: inset(0 0 0 0);
    opacity: 0;
  }
}

@keyframes hudSweep {
  0%,
  28% {
    transform: translateX(-120%);
  }

  62%,
  100% {
    transform: translateX(130%);
  }
}

@keyframes neuralNodeDrift {
  from {
    filter: drop-shadow(0 0 2px rgba(255, 48, 53, 0.36));
    opacity: 0.74;
    transform: translate3d(-1px, 1px, 0) scale(0.92);
  }

  to {
    filter: drop-shadow(0 0 6px rgba(255, 48, 53, 0.72));
    opacity: 1;
    transform: translate3d(1.5px, -1.5px, 0) scale(1.12);
  }
}

@keyframes neuralCorePulse {
  from {
    filter: drop-shadow(0 0 5px rgba(255, 48, 53, 0.52));
    transform: scale(0.94);
  }

  to {
    filter:
      drop-shadow(0 0 9px rgba(255, 48, 53, 0.82))
      drop-shadow(0 0 18px rgba(214, 40, 40, 0.42));
    transform: scale(1.12);
  }
}

@keyframes neuralLinePulse {
  from {
    opacity: 0.34;
    stroke-width: 0.85;
  }

  to {
    opacity: 0.82;
    stroke-width: 1.25;
  }
}

@keyframes neuralLightningFlicker {
  from {
    stroke-width: 1.15;
    transform: translate3d(-0.35px, 0.2px, 0);
  }

  to {
    stroke-width: 1.75;
    transform: translate3d(0.45px, -0.35px, 0);
  }
}

@keyframes coreOrbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes corePulse {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(0.9);
  }

  48% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (max-width: 900px) {
  .hud-neural {
    height: 20%;
    left: 55%;
    top: 38%;
    width: 43%;
  }

  .hud-code {
    display: none;
  }

  .hud-core-card {
    left: 39%;
    top: 62%;
    width: 45%;
  }
}

@media (max-width: 760px) {
  .hero-hud {
    display: none;
  }
}

@media (max-width: 520px) {
  .hero-hud {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-panel,
  .hud-panel::after,
  .page-home .hud-panel::before,
  .page-home .hud-code,
  .page-home .hud-neural,
  .page-home .hud-core-card,
  .hud-neural-map circle,
  .hud-neural-map line,
  .hud-neural-lightning.is-active,
  .hud-core-orbit,
  .hud-core-pulse {
    animation: none;
  }

  .hud-log-line {
    transition: none;
  }
}
