:root {
  --bg: #05080f;
  --panel: rgba(16, 22, 34, 0.72);
  --panel-border: rgba(120, 170, 220, 0.16);
  --text: #e6ecf5;
  --text-muted: #8b9bb4;
  --accent: #38bdf8;
  --online: #34d399;
  --radius: 16px;
  --grid-line: rgba(120, 170, 220, 0.055);
  --grid-size: 64px;
  --beam: #7dd3fc;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px var(--grid-size)),
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px var(--grid-size)),
    radial-gradient(115% 80% at 50% -12%, rgba(32, 68, 132, 0.5) 0%, rgba(6, 11, 20, 0) 62%);
}

.mesh {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.link {
  fill: none;
  stroke: rgba(120, 170, 220, 0.13);
  stroke-width: 1;
}

/* a packet in transit: one dash per link, walked along the path in a quick burst.
   three stacked dashes with increasing lag make the trail taper behind the head. */
.beam {
  --beam-opacity: 1;
  fill: none;
  opacity: 0;
  stroke: var(--beam);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 3 97;
  filter: drop-shadow(0 0 5px var(--beam));
  animation: beam-head var(--beam-duration) linear var(--beam-delay) infinite;
}

.beam--mid {
  --beam-opacity: 0.45;
  stroke-width: 1.5;
  stroke-dasharray: 4.5 95.5;
  filter: none;
  animation-name: beam-mid;
}

.beam--tail {
  --beam-opacity: 0.18;
  stroke-width: 0.9;
  stroke-dasharray: 7 93;
  filter: none;
  animation-name: beam-tail;
}

.packet--reverse .beam {
  animation-direction: reverse;
}

.node {
  animation: node-float var(--float-duration) ease-in-out var(--float-delay) infinite;
}

/* a ring that expands out of the dot and fades, rather than a standing disc.
   transform-box is required: without it scale() resolves against the viewBox,
   which drags the ring away from its own node.
   backwards holds the 0% state through the start delay, otherwise every ring
   sits fully drawn on screen until its first ping. */
.node .halo {
  fill: none;
  opacity: 0;
  stroke: rgba(125, 211, 252, 0.4);
  stroke-width: 0.8;
  transform-box: fill-box;
  transform-origin: center;
  animation: node-pulse var(--float-duration) ease-out var(--float-delay) infinite backwards;
}

.node .dot {
  fill: #bae6fd;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.7));
}

/* crosses the link during the first quarter of the cycle, then idles until the next burst.
   the three offsets are the head's, lagged by 3 and 7.5, which is what tapers the trail.
   they must be literal here: a calc() built from a custom property fails to interpolate. */
@keyframes beam-head {
  0% {
    stroke-dashoffset: 100;
    opacity: 0;
  }
  4% {
    opacity: var(--beam-opacity);
  }
  22% {
    opacity: var(--beam-opacity);
  }
  28% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}

@keyframes beam-mid {
  0% {
    stroke-dashoffset: 103;
    opacity: 0;
  }
  4% {
    opacity: var(--beam-opacity);
  }
  22% {
    opacity: var(--beam-opacity);
  }
  28% {
    stroke-dashoffset: 3;
    opacity: 0;
  }
  100% {
    stroke-dashoffset: 3;
    opacity: 0;
  }
}

@keyframes beam-tail {
  0% {
    stroke-dashoffset: 107.5;
    opacity: 0;
  }
  4% {
    opacity: var(--beam-opacity);
  }
  22% {
    opacity: var(--beam-opacity);
  }
  28% {
    stroke-dashoffset: 7.5;
    opacity: 0;
  }
  100% {
    stroke-dashoffset: 7.5;
    opacity: 0;
  }
}

@keyframes node-float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(3px, -3px);
  }
}

/* one ping per float cycle: the ring grows out of the dot over the first third,
   then stays spent until the cycle restarts, so only a few nodes ping at a time. */
@keyframes node-pulse {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }
  6% {
    opacity: 0.6;
  }
  34% {
    opacity: 0;
    transform: scale(1.9);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .beam,
  .node,
  .node .halo {
    animation: none;
  }
}

main {
  width: 820px;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--panel-border);
}

.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 0;
}

.main-content > p:first-child {
  margin-top: 0;
}

.main-content > p:last-child {
  margin-bottom: 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
}

.empty {
  color: var(--text-muted);
  font-style: italic;
}

.error-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
}

.client-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-name {
  font-size: 16px;
  font-weight: 600;
}

.client-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.client-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.client-status--online {
  color: var(--online);
}

.client-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.client-meta code {
  color: var(--text);
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  main {
    height: 100%;
    border: none;
    border-radius: 0;
    padding: 20px;
  }
}
