:root {
  color-scheme: dark;
  --pointer-x: 50%;
  --pointer-y: 50%;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #090a0d;
}

body {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.artwork {
  position: relative;
  width: 100vw;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--pointer-x) var(--pointer-y), rgba(79, 74, 125, 0.13), transparent 24%),
    radial-gradient(circle at 50% 50%, #13131a 0%, #090a0d 68%);
}

.artwork::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  content: "";
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.25) 82%, rgba(0, 0, 0, 0.58) 125%);
}

#signal {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

#signal-glow {
  opacity: 0.44;
}

#signal-ribbon {
  opacity: 0.94;
}

#signal-texture {
  opacity: 0.28;
  pointer-events: none;
  mix-blend-mode: overlay;
}

.flow-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 0.62;
  vector-effect: non-scaling-stroke;
  mix-blend-mode: screen;
}

.morse-mark {
  pointer-events: none;
  mix-blend-mode: normal;
  stroke: none;
}

#morse-stream {
  display: none;
}

.shock-drop {
  pointer-events: none;
  fill: #ffffff;
  fill-opacity: 0.35;
  stroke: none;
}

.morse-dot {
  fill: #ffffff;
  fill-opacity: 0.35;
  mix-blend-mode: normal;
}

.morse-dash {
  fill: #ffffff;
  fill-opacity: 0.35;
}

.grain {
  position: absolute;
  inset: -40%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
  animation: grain 0.3s steps(2) infinite;
}

.pulse-ring {
  position: fixed;
  z-index: 5;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  pointer-events: none;
  translate: -50% -50%;
  animation: pulse-ring 0.72s cubic-bezier(0.12, 0.58, 0.22, 1) forwards;
}

@keyframes pulse-ring {
  from { scale: 0.25; opacity: 0.52; }
  to { scale: 4.5; opacity: 0; }
}

@keyframes grain {
  0% { translate: 0 0; }
  25% { translate: 3% -2%; }
  50% { translate: -2% 3%; }
  75% { translate: 2% 4%; }
  100% { translate: -3% -3%; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}
