:root {
  --bg: #04060d;
  --bg-soft: #0b0f1b;
  --panel: rgba(7, 10, 20, 0.5);
  --line: rgba(192, 167, 255, 0.2);
  --line-bright: rgba(126, 231, 255, 0.42);
  --text: #fbf6ff;
  --muted: rgba(251, 246, 255, 0.58);
  --cyan: #7ee7ff;
  --violet: #c0a7ff;
  --rose: #ff8fdb;
  --peach: #ffbc9b;
  --glow-x: 50%;
  --glow-y: 50%;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -6;
  background:
    radial-gradient(circle at 16% 18%, rgba(126, 231, 255, 0.15), transparent 26%),
    radial-gradient(circle at 82% 22%, rgba(255, 143, 219, 0.13), transparent 24%),
    radial-gradient(circle at 54% 82%, rgba(255, 188, 155, 0.1), transparent 30%),
    radial-gradient(circle at 50% 52%, rgba(192, 167, 255, 0.08), transparent 26%),
    radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(192, 167, 255, 0.16), transparent 18%),
    linear-gradient(160deg, #0b1220 0%, #04050b 42%, #130b18 100%);
}

.field,
.noise,
.scanlines,
.grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.field {
  z-index: -5;
  width: 100%;
  height: 100%;
}

.noise {
  inset: -50%;
  z-index: 3;
  opacity: 0.11;
  mix-blend-mode: soft-light;
  background:
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.05) 0 1px,
      transparent 1px 5px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0 1px,
      transparent 1px 7px
    );
  animation: grain-shift 12s steps(6) infinite;
}

.scanlines {
  z-index: 4;
  opacity: 0.08;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0 1px,
    transparent 1px 4px
  );
}

.grid {
  z-index: 0;
  inset: auto -40vw -35vh -40vw;
  height: 72vh;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(192, 167, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 231, 255, 0.12) 1px, transparent 1px);
  background-size: clamp(2.8rem, 4vw, 4rem) clamp(2.8rem, 4vw, 4rem);
  transform-origin: center bottom;
  transform: perspective(65rem) rotateX(77deg);
  mask: linear-gradient(to top, rgba(255, 255, 255, 0.95) 12%, transparent 92%);
}

.viewport {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  padding: clamp(1rem, 3vw, 2rem);
  display: grid;
  place-items: center;
}

.hud {
  position: absolute;
  left: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-top {
  top: clamp(1rem, 3vw, 2rem);
}

.hud-bottom {
  bottom: clamp(1rem, 3vw, 2rem);
}

.relay-stage {
  width: min(100%, 74rem);
  display: grid;
  place-items: center;
}

.relay-frame {
  position: relative;
  width: min(100%, 58rem);
  min-height: min(76vh, 46rem);
  padding: clamp(2rem, 5vw, 4rem);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2rem;
  clip-path: polygon(
    1.6rem 0,
    calc(100% - 1.6rem) 0,
    100% 1.6rem,
    100% calc(100% - 1.6rem),
    calc(100% - 1.6rem) 100%,
    1.6rem 100%,
    0 calc(100% - 1.6rem),
    0 1.6rem
  );
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.26), rgba(6, 8, 16, 0.58)),
    radial-gradient(circle at 50% 50%, rgba(126, 231, 255, 0.12), transparent 44%),
    radial-gradient(circle at 52% 54%, rgba(192, 167, 255, 0.12), transparent 58%),
    radial-gradient(circle at 56% 48%, rgba(255, 143, 219, 0.06), transparent 34%);
  box-shadow:
    inset 0 0 0 1px rgba(126, 231, 255, 0.06),
    0 0 46px rgba(126, 231, 255, 0.06),
    0 0 72px rgba(255, 143, 219, 0.04),
    0 42px 120px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
  transform: perspective(70rem) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 180ms ease-out;
}

.relay-frame::before,
.relay-frame::after {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(126, 231, 255, 0.11);
  border-radius: 1.3rem;
  clip-path: inherit;
}

.relay-frame::after {
  inset: 1.65rem;
  border-color: rgba(255, 143, 219, 0.1);
}

.beam {
  position: absolute;
  inset: 50%;
  display: block;
  opacity: 0.48;
}

.beam-x {
  width: 72%;
  height: 1px;
  transform: translate(-50%, -50%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(126, 231, 255, 0.82),
    transparent
  );
}

.beam-y {
  width: 1px;
  height: 72%;
  transform: translate(-50%, -50%);
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255, 143, 219, 0.62),
    transparent
  );
}

.signal-core {
  position: absolute;
  width: clamp(18rem, 48vw, 32rem);
  aspect-ratio: 1;
  filter:
    drop-shadow(0 0 36px rgba(126, 231, 255, 0.16))
    drop-shadow(0 0 28px rgba(255, 143, 219, 0.08));
}

.signal-core::before,
.signal-core::after {
  content: "";
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.signal-core::before {
  width: 130%;
  height: 130%;
  background: radial-gradient(
    circle,
    rgba(192, 167, 255, 0.11),
    rgba(126, 231, 255, 0.05) 25%,
    transparent 64%
  );
}

.signal-core::after {
  width: 18%;
  height: 18%;
  border: 1px solid rgba(251, 246, 255, 0.34);
  box-shadow: 0 0 24px rgba(126, 231, 255, 0.12);
}

.ring,
.orbit,
.pulse {
  position: absolute;
  border-radius: 50%;
  inset: 0;
  margin: auto;
}

.ring {
  border: 1px solid rgba(192, 167, 255, 0.22);
}

.ring-a {
  width: 100%;
  height: 100%;
  animation: spin 22s linear infinite;
}

.ring-b {
  width: 78%;
  height: 78%;
  border-style: dashed;
  animation: spin-reverse 18s linear infinite;
}

.ring-c {
  width: 58%;
  height: 58%;
  border-color: rgba(126, 231, 255, 0.34);
}

.ring-d {
  width: 28%;
  height: 28%;
  border-color: rgba(255, 143, 219, 0.42);
  box-shadow:
    inset 0 0 24px rgba(255, 143, 219, 0.16),
    0 0 24px rgba(255, 143, 219, 0.16);
}

.orbit {
  border: 1px solid transparent;
}

.orbit .satellite {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.72rem;
  height: 0.72rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(251, 246, 255, 1), rgba(255, 188, 155, 0.94) 32%, rgba(126, 231, 255, 0.2));
  box-shadow:
    0 0 24px rgba(255, 143, 219, 0.46),
    0 0 48px rgba(126, 231, 255, 0.24);
}

.orbit-a {
  width: 100%;
  height: 100%;
  animation: spin 16s linear infinite;
}

.orbit-b {
  width: 78%;
  height: 78%;
  animation: spin-reverse 10s linear infinite;
}

.orbit-c {
  width: 58%;
  height: 58%;
  animation: spin 13s linear infinite;
}

.pulse {
  width: 22%;
  height: 22%;
  background: radial-gradient(
    circle,
    rgba(255, 188, 155, 0.8),
    rgba(255, 143, 219, 0.3) 42%,
    rgba(126, 231, 255, 0) 72%
  );
  animation: pulse 3.4s ease-in-out infinite;
}

.wordmark {
  position: relative;
  width: min(100%, 44rem);
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.micro {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(0.64rem, 1vw, 0.72rem);
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
}

.micro-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.4rem;
}

.brand {
  position: relative;
  margin: 0;
  max-width: 100%;
  font-size: clamp(2.35rem, 7vw, 6.25rem);
  line-height: 0.94;
  font-weight: 700;
  letter-spacing: clamp(0.08em, 0.9vw, 0.14em);
  text-transform: lowercase;
  white-space: nowrap;
  text-shadow:
    0 0 24px rgba(126, 231, 255, 0.24),
    0 0 44px rgba(255, 143, 219, 0.12),
    0 0 72px rgba(0, 0, 0, 0.28);
}

.brand::before,
.brand::after {
  content: attr(data-shadow);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.brand::before {
  color: rgba(126, 231, 255, 0.42);
  transform: translate(-0.045em, -0.02em);
  clip-path: inset(0 0 52% 0);
}

.brand::after {
  color: rgba(255, 143, 219, 0.36);
  transform: translate(0.045em, 0.03em);
  clip-path: inset(48% 0 0 0);
}

.signal-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.signal-bar span {
  display: block;
  width: clamp(2.6rem, 8vw, 4rem);
  height: 0.2rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(192, 167, 255, 0.2),
    rgba(126, 231, 255, 0.9),
    rgba(255, 143, 219, 0.32)
  );
  box-shadow:
    0 0 18px rgba(126, 231, 255, 0.24),
    0 0 28px rgba(255, 143, 219, 0.08);
  animation: bar-pulse 2.4s ease-in-out infinite;
}

.signal-bar span:nth-child(2) {
  animation-delay: 0.15s;
}

.signal-bar span:nth-child(3) {
  animation-delay: 0.3s;
}

.signal-bar span:nth-child(4) {
  animation-delay: 0.45s;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.76;
  }

  50% {
    transform: scale(1.14);
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-reverse {
  from {
    transform: rotate(360deg);
  }

  to {
    transform: rotate(0deg);
  }
}

@keyframes bar-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scaleX(0.88);
  }

  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes grain-shift {
  0% {
    transform: translate(0, 0);
  }

  20% {
    transform: translate(3%, -4%);
  }

  40% {
    transform: translate(-4%, 3%);
  }

  60% {
    transform: translate(2%, 4%);
  }

  80% {
    transform: translate(-3%, -2%);
  }

  100% {
    transform: translate(0, 0);
  }
}

@media (max-width: 760px) {
  .hud {
    font-size: 0.62rem;
    letter-spacing: 0.2em;
  }

  .hud span:first-child,
  .micro-top {
    display: none;
  }

  .relay-frame {
    min-height: min(78svh, 42rem);
    border-radius: 1.5rem;
  }

  .wordmark {
    width: min(100%, 34rem);
  }

  .brand {
    font-size: clamp(2rem, 9vw, 4.2rem);
    letter-spacing: 0.08em;
  }

  .grid {
    inset: auto -55vw -28vh -55vw;
    height: 60vh;
  }

  .signal-core {
    width: min(82vw, 28rem);
  }

  .micro-bottom {
    gap: 0.55rem 0.9rem;
    letter-spacing: 0.22em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .relay-frame {
    transform: none;
  }
}
