:root {
  color-scheme: dark;
  --ink: #050706;
  --ink-soft: #0a0e0c;
  --mist: #d7e7e0;
  --silver: #9eb7ad;
  --ghost: rgba(193, 224, 211, 0.16);
  --hairline: rgba(196, 228, 215, 0.22);
  --signal: #bfffe2;
  --blade-angle: -7deg;
  --blade-scale: 1;
  --energy: 0.12;
  --mark-scale: 1;
  --scene-x: 0deg;
  --scene-y: 0deg;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* The document viewport is deliberately locked: the signal is the scroll surface. */
  min-width: 320px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

body {
  /* Fixed edges remove elastic overscroll and stray SVG layout space on mobile. */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--mist);
  background:
    radial-gradient(circle at 50% 46%, rgba(65, 99, 85, 0.18), transparent 34%),
    radial-gradient(circle at 50% 112%, rgba(110, 155, 137, 0.08), transparent 42%),
    var(--ink);
  font-family: "Helvetica Neue", "Nimbus Sans L", Arial, sans-serif;
  text-rendering: geometricPrecision;
}

.field,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.field {
  opacity: 0.58;
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-position: center;
  background-size: min(11vw, 108px) min(11vw, 108px);
  mask-image: radial-gradient(circle at center, black, transparent 68%);
}

.grain {
  z-index: 20;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.24'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.coordinates,
.telemetry {
  position: fixed;
  z-index: 5;
  left: clamp(22px, 4vw, 64px);
  right: clamp(22px, 4vw, 64px);
  display: grid;
  align-items: center;
  color: rgba(201, 222, 213, 0.44);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1;
  text-transform: uppercase;
}

.coordinates {
  top: clamp(28px, 5vw, 70px);
  grid-template-columns: 1fr 1fr;
}

.coordinates span:last-child {
  text-align: right;
}

.telemetry {
  bottom: clamp(28px, 5vw, 70px);
  grid-template-columns: 1fr auto 1fr;
}

.telemetry span:last-child {
  text-align: right;
}

.pulse {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pulse i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 10px var(--signal);
  animation: beacon 4s ease-in-out infinite;
}

main {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 88px 20px 92px;
}

.signal {
  /* Touch gestures are handled as momentum and never become page scrolling. */
  display: grid;
  width: min(82vw, 650px);
  justify-items: center;
  outline: none;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.signal:focus-visible .sigil-wrap::after {
  opacity: 0.72;
}

.eyebrow {
  margin: 0 0 clamp(4px, 1vh, 12px);
  color: rgba(201, 222, 213, 0.42);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.34em;
}

.sigil-wrap {
  position: relative;
  display: grid;
  width: min(67vh, 76vw, 590px);
  aspect-ratio: 1;
  overflow: hidden;
  perspective: 900px;
  place-items: center;
}

.sigil-wrap::before,
.sigil-wrap::after {
  position: absolute;
  z-index: 3;
  inset: 7.5%;
  border: 1px solid rgba(191, 255, 226, 0.1);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease;
}

.sigil-wrap::before {
  opacity: calc(0.08 + var(--energy) * 0.34);
  transform: scale(calc(0.97 + var(--energy) * 0.04));
  box-shadow:
    inset 0 0 34px rgba(170, 255, 220, 0.04),
    0 0 28px rgba(170, 255, 220, 0.04);
}

.sigil-wrap::after {
  inset: 15%;
  border-color: rgba(225, 255, 242, 0.08);
  border-style: dashed;
  opacity: 0.2;
}

.game-hud {
  position: absolute;
  z-index: 4;
  inset: 13%;
  display: grid;
  grid-template: auto 1fr auto / 1fr 1fr;
  color: rgba(199, 229, 216, 0.46);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(6px, 1.25vw, 9px);
  letter-spacing: 0.22em;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
}

.hud-sector {
  justify-self: start;
}

.hud-score {
  justify-self: end;
  color: rgba(216, 255, 238, calc(0.32 + var(--energy) * 0.5));
}

.hud-direction {
  align-self: end;
  justify-self: start;
}

.hud-charge {
  align-self: end;
  justify-self: end;
  width: clamp(28px, 8vw, 54px);
  height: 2px;
  overflow: hidden;
  background: rgba(191, 255, 226, 0.12);
}

.hud-charge i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
  transform: scaleX(var(--energy));
  transform-origin: left center;
}

.radar {
  position: absolute;
  width: 66%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.32;
  background: conic-gradient(
    from 195deg,
    transparent 0 74%,
    rgba(166, 255, 216, 0.25) 79%,
    transparent 84% 100%
  );
  filter: blur(16px);
  animation: radar 22s linear infinite;
}

.sigil {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  filter: drop-shadow(0 30px 55px rgba(0, 0, 0, 0.72));
  transform-origin: center;
}

.orbit,
.axis,
.angle {
  fill: none;
  stroke: rgba(180, 210, 198, 0.22);
  vector-effect: non-scaling-stroke;
}

.orbit-a {
  stroke-width: 0.7;
  stroke-dasharray: 1 16;
  stroke-linecap: round;
  transform-origin: 320px 320px;
  animation: orbit-clock 46s linear infinite;
}

.orbit-b {
  stroke-width: 0.45;
  stroke-dasharray: 68 22 4 34;
  opacity: 0.42;
  transform-origin: 320px 320px;
  animation: orbit-counter 64s linear infinite;
}

.axis {
  stroke-width: 0.7;
  stroke-dasharray: 3 7;
}

.angle {
  stroke-width: 1;
  stroke-dasharray: 18 7 2 10;
}

.ring-glow {
  fill: none;
  stroke: rgba(137, 255, 209, 0.12);
  stroke-width: 104;
  filter: url("#soft-glow");
  animation: ring-aura 8s ease-in-out infinite;
}

.ring-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, 0.74);
  stroke-width: 72;
  transform: translate(0 7px);
}

.ring-body {
  fill: none;
  stroke: url("#ring-metal");
  stroke-width: 64;
  stroke-linecap: round;
  transform-origin: 320px 320px;
  animation: ring-breathe 10s ease-in-out infinite;
}

.ring-highlight {
  fill: none;
  stroke: rgba(235, 255, 247, 0.24);
  stroke-width: 1.2;
}

.ring-inner {
  fill: url("#inner-dark");
  stroke: rgba(198, 227, 215, 0.12);
  stroke-width: 1;
}

.echoes,
.blade,
.fragments {
  transform-origin: 320px 320px;
}

.echoes {
  animation: echo-angle 18s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.echo {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.echo-a {
  stroke: rgba(151, 255, 213, 0.2);
  stroke-width: 1;
  stroke-dasharray: 56 252;
  animation: trace 9s ease-in-out infinite;
}

.echo-b {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 0.7;
  stroke-dasharray: 12 296;
  animation: trace 11s 1.8s ease-in-out infinite reverse;
}

.echo-c {
  stroke: rgba(137, 255, 209, 0.14);
  stroke-width: 4;
  filter: url("#soft-glow");
  opacity: 0.52;
}

.blade {
  filter: url("#blade-glow");
  animation: blade-angle 18s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.blade-shadow {
  fill: rgba(0, 0, 0, 0.78);
  transform: translate(5px, 9px);
}

.blade-body {
  fill: url("#blade-metal");
}

.blade-light,
.blade-cut {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.blade-light {
  stroke: rgba(255, 255, 255, 0.76);
  stroke-width: 1.4;
}

.blade-cut {
  stroke: rgba(185, 255, 225, 0.52);
  stroke-width: 0.7;
  stroke-dasharray: 48 360;
  animation: cut-light 7s ease-in-out infinite;
}

.fragments {
  fill: none;
  stroke: rgba(202, 255, 233, 0.42);
  stroke-linecap: round;
  animation: fragment-angle 18s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.mark {
  transform-origin: 320px 320px;
}

html.interactive .signal {
  cursor: crosshair;
}

html.interactive .signal:active {
  cursor: grabbing;
}

html.interactive .sigil {
  will-change: transform;
  transform: rotateX(var(--scene-y)) rotateY(var(--scene-x));
}

html.interactive .mark {
  /* JavaScript maps velocity-derived energy to the central mark's scale. */
  will-change: transform;
  transform: scale(var(--mark-scale));
}

html.interactive .blade {
  /* Live momentum replaces the passive animation with angle and scale transforms. */
  animation: none;
  will-change: transform;
  transform: rotate(var(--blade-angle)) scaleY(var(--blade-scale));
}

html.interactive .echoes {
  animation: none;
  transform: rotate(calc(var(--blade-angle) - 4deg)) scale(calc(1 + var(--energy) * 0.025));
}

html.interactive .fragments {
  animation: none;
  transform: rotate(calc(var(--blade-angle) + 2deg));
}

html.interactive .ring-glow {
  animation: none;
  opacity: calc(0.22 + var(--energy) * 0.62);
  stroke-width: calc(94px + var(--energy) * 26px);
}

html.interactive.engaged .field {
  opacity: 0.76;
}

html.interactive.engaged .grain {
  opacity: 0.25;
}

.signal.is-surge .sigil-wrap::before {
  border-color: rgba(191, 255, 226, 0.28);
  box-shadow:
    inset 0 0 48px rgba(170, 255, 220, 0.08),
    0 0 44px rgba(170, 255, 220, 0.1);
}

.signal.is-shifting .hud-direction {
  animation: vector-shift 520ms steps(2, end);
}

.fragment {
  stroke-dasharray: 2 5;
}

.fragment-a {
  animation: flicker 5s ease-in-out infinite;
}

.fragment-b {
  animation: flicker 5s 1.3s ease-in-out infinite;
}

.fragment-c {
  animation: flicker 5s 2.8s ease-in-out infinite;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(-14px, -1.8vh, -5px) 0 0;
  color: rgba(230, 246, 239, 0.84);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(12px, 1.4vw, 16px);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: lowercase;
}

.wordmark i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.48;
}

.message {
  margin: clamp(14px, 2.2vh, 24px) 0 0;
  color: rgba(194, 213, 205, 0.4);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(11px, 1.2vw, 14px);
  font-style: italic;
  letter-spacing: 0.08em;
}

.interaction-hint {
  margin: 11px 0 0;
  color: rgba(191, 218, 207, 0.26);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.motion-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  margin-top: 10px;
  padding: 5px 9px;
  border: 1px solid rgba(191, 255, 226, 0.16);
  border-radius: 999px;
  color: rgba(213, 239, 228, 0.48);
  background: rgba(11, 18, 15, 0.54);
  font: 500 7px/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
}

.motion-control[hidden] {
  display: none;
}

.motion-control i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.motion-control:hover,
.motion-control:focus-visible {
  border-color: rgba(191, 255, 226, 0.4);
  color: rgba(231, 255, 245, 0.86);
  outline: none;
}

.motion-control:disabled {
  color: rgba(191, 255, 226, 0.7);
  cursor: default;
}

html.motion-linked .motion-control i {
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes blade-angle {
  0%,
  100% {
    transform: rotate(-7deg) translate(-2px, 1px) scaleY(0.97);
  }
  19% {
    transform: rotate(-19deg) translate(2px, -1px) scaleY(1.03);
  }
  43% {
    transform: rotate(8deg) translate(-1px, -2px) scaleY(0.99);
  }
  68% {
    transform: rotate(-27deg) translate(3px, 1px) scaleY(1.04);
  }
  84% {
    transform: rotate(2deg) translate(0, -1px) scaleY(0.96);
  }
}

@keyframes echo-angle {
  0%,
  100% {
    opacity: 0.26;
    transform: rotate(-12deg) scale(1.01);
  }
  19% {
    opacity: 0.58;
    transform: rotate(-24deg) scale(1.03);
  }
  43% {
    opacity: 0.22;
    transform: rotate(13deg) scale(0.99);
  }
  68% {
    opacity: 0.62;
    transform: rotate(-31deg) scale(1.02);
  }
  84% {
    opacity: 0.34;
    transform: rotate(7deg) scale(1);
  }
}

@keyframes fragment-angle {
  0%,
  100% {
    transform: rotate(-5deg);
  }
  19% {
    transform: rotate(-21deg);
  }
  43% {
    transform: rotate(6deg);
  }
  68% {
    transform: rotate(-29deg);
  }
  84% {
    transform: rotate(1deg);
  }
}

@keyframes ring-breathe {
  0%,
  100% {
    opacity: 0.9;
    transform: rotate(0deg) scale(0.994);
  }
  50% {
    opacity: 1;
    transform: rotate(2deg) scale(1.008);
  }
}

@keyframes ring-aura {
  0%,
  100% {
    opacity: 0.32;
    stroke-width: 98;
  }
  50% {
    opacity: 0.64;
    stroke-width: 112;
  }
}

@keyframes trace {
  0%,
  100% {
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dashoffset: -308;
  }
}

@keyframes cut-light {
  0%,
  100% {
    stroke-dashoffset: 0;
    opacity: 0.25;
  }
  44% {
    opacity: 0.9;
  }
  55% {
    stroke-dashoffset: -408;
    opacity: 0.36;
  }
}

@keyframes orbit-clock {
  to {
    transform: rotate(360deg);
  }
}

@keyframes orbit-counter {
  to {
    transform: rotate(-360deg);
  }
}

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

@keyframes beacon {
  0%,
  100% {
    opacity: 0.22;
    transform: scale(0.72);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 0.12;
  }
  42% {
    opacity: 0.72;
  }
  48% {
    opacity: 0.2;
  }
  54% {
    opacity: 0.62;
  }
}

@keyframes vector-shift {
  0%,
  100% {
    opacity: 1;
    transform: translateX(0);
  }
  35% {
    opacity: 0.18;
    transform: translateX(5px);
  }
  68% {
    opacity: 0.82;
    transform: translateX(-3px);
  }
}

@media (max-width: 640px) {
  main {
    display: block;
    padding-inline: 0;
  }

  .signal {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    max-width: none;
    padding-inline: 12px;
    transform: translate(-50%, -50%);
    touch-action: none;
  }

  .telemetry {
    grid-template-columns: 1fr 1fr;
  }

  .telemetry .pulse {
    display: none;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  .sigil-wrap {
    width: min(72vh, 92vw, 560px);
    margin-inline: auto;
  }

  .wordmark {
    margin-top: -4px;
  }
}

@media (max-height: 610px) {
  .coordinates,
  .telemetry {
    display: none;
  }

  main {
    padding-block: 28px;
  }

  .sigil-wrap {
    width: min(64vh, 72vw, 510px);
  }

  .message {
    margin-top: 8px;
  }

  .interaction-hint {
    margin-top: 6px;
  }

  .motion-control {
    margin-top: 6px;
  }
}

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