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

@keyframes blip {
  0% {
    background-color: rgba(0, 255, 100);
    box-shadow:
      0 0 10px rgba(0, 255, 100),
      0 0 20px rgba(0, 255, 100);
  }
  10% {
    background-color: #00332c;
    box-shadow: 0 0 2px rgba(0, 255, 100, 0.8);
  }
  100% {
    background-color: #00332c;
    box-shadow: 0 0 2px rgba(0, 255, 100, 0.2);
  }
}

:root {
  --max-dist: min(75vh, 75vw);
}

* {
  font-family: "Courier New", Courier, monospace, sans-serif;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #030803;
}

.radar-screen {
  position: relative;
  aspect-ratio: 1;
  width: var(--max-dist);
  overflow: hidden;
  background: radial-gradient(circle, #051a05 0%, #020a02 100%);
  box-shadow:
    0 0 25px rgba(0, 255, 100, 0.4),
    inset 0 0 25px rgba(0, 255, 100, 0.4);
  border-radius: 50%;
}

.range-arc {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(0, 255, 100, 0.3);
  top: calc(50% - var(--size) / 2);
  left: calc(50% - var(--size) / 2);
}

.range-arc:after {
  content: "Lorem";
  position: absolute;
  right: 5px;
  top: 50%;
  color: rgba(0, 255, 100, 0.7);
  font-size: 0.75rem;
  text-shadow: 0 0 4px #00ff66;
}

.sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: rotate 4s linear infinite;
  pointer-events: none;
  background: conic-gradient(
    from 0deg at 50% 50%,
    rgba(0, 255, 100, 0) 0deg,
    rgba(0, 255, 100, 0) 270deg,
    rgba(0, 255, 100, 0.2) 345deg,
    rgba(0, 255, 100, 0.8) 359.5deg,
    #00ff66 360deg
  );
}

.range-5nm {
  --size: 33%;
}

.range-5nm:after {
  content: "5 NM";
}

.range-10nm {
  --size: 66%;
}

.range-10nm:after {
  content: "10 NM";
}

.range-15nm {
  --size: 98%;
}

.range-15nm:after {
  content: "15 NM";
}

.plane {
  --bearing: random(--bearing-seed element-scoped, 0deg, 360deg);
  --distance: random(--distance-seed element-scoped, 0px, var(--max-dist));

  --pos-x: calc(cos(var(--bearing)) * var(--distance) + 50%);
  --pos-y: calc(sin(var(--bearing)) * var(--distance) + 50%);

  left: var(--pos-x);
  top: var(--pos-y);

  position: absolute;
  width: 8px;
  height: 8px;
  background: #00ff66;
  box-shadow: 0 0 6px #00ff66;
  border-radius: 50%;

  animation: blip 4s linear infinite;
  animation-delay: calc(((var(--bearing) + 90deg) / 90deg) * 1s);
}

.plane:after {
  --velocity: random(--velocity-seed element-scoped, 30px, 150px);
  --direction: random(--direction-seed element-scoped, 0deg, 360deg);

  content: "";
  border-bottom: 1px solid rgba(0, 255, 100, 0.6);
  transform-origin: center left;
  display: block;

  width: var(--velocity);
  transform: translate(4px, 4px) rotate(var(--direction));
}

.plane:before {
  content: var(--text);

  position: absolute;
  top: 1rem;
  width: 150px;

  color: rgba(0, 255, 100, 0.7);
  font-size: 0.75rem;
  text-shadow: 0 0 4px #00ff66;
  white-space: pre-line;
}

/* Linked contacts: amber blips that open each server */
@keyframes blip-target {
  0% {
    background-color: #ffc23d;
    box-shadow:
      0 0 10px #ffc23d,
      0 0 20px #ffc23d;
  }
  10% {
    background-color: #5a3f00;
    box-shadow: 0 0 3px rgba(255, 194, 61, 0.9);
  }
  100% {
    background-color: #5a3f00;
    box-shadow: 0 0 3px rgba(255, 194, 61, 0.5);
  }
}

.plane.target {
  z-index: 2;
  width: 10px;
  height: 10px;
  cursor: pointer;
  text-decoration: none;
  animation-name: blip-target;
  outline: 1px solid rgba(255, 194, 61, 0.6);
  outline-offset: 3px;
}

.plane.target:before {
  color: rgba(255, 194, 61, 0.85);
  text-shadow: 0 0 4px #ffaa00;
  width: auto;
  white-space: pre;
  padding: 2px 4px;
}

.plane.target:after {
  border-bottom-color: rgba(255, 194, 61, 0.5);
}

.plane.target:hover:before,
.plane.target:focus-visible:before {
  color: #ffd877;
  text-shadow: 0 0 8px #ffaa00;
  background: rgba(255, 194, 61, 0.12);
  outline: 1px solid rgba(255, 194, 61, 0.6);
}

.plane.target:focus-visible {
  outline: 2px solid #ffd877;
}
