:root {
  --background: 222 39% 8%;
  --foreground: 180 20% 92%;
  --primary: 142 86% 56%;
  --secondary: 357 84% 58%;
  --muted: 220 18% 18%;
  --destructive: 357 84% 58%;
  --border: 180 12% 24%;
  --card: 224 36% 11%;
  --warning: 47 100% 55%;
  --shadow-sm: 0 0 0 1px hsla(180, 20%, 70%, 0.08), 0 8px 20px hsla(0, 0%, 0%, 0.18);
  --shadow-md: 0 0 0 1px hsla(180, 20%, 70%, 0.12), 0 16px 40px hsla(0, 0%, 0%, 0.32);
  --shadow-lg: 0 0 24px hsla(142, 86%, 56%, 0.18), 0 0 48px hsla(357, 84%, 58%, 0.12), 0 20px 60px hsla(0, 0%, 0%, 0.5);
  --transition-fast: 160ms ease;
  --transition-smooth: 320ms cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

.dark {
  --background: 222 39% 8%;
  --foreground: 180 20% 92%;
  --primary: 142 86% 56%;
  --secondary: 357 84% 58%;
  --muted: 220 18% 18%;
  --destructive: 357 84% 58%;
  --border: 180 12% 24%;
  --card: 224 36% 11%;
}

* {
  box-sizing: border-box;
}

html, body, #root {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, hsla(142, 86%, 56%, 0.08), transparent 25%),
    radial-gradient(circle at 80% 0%, hsla(357, 84%, 58%, 0.09), transparent 30%),
    linear-gradient(180deg, hsla(224, 40%, 7%, 1), hsla(222, 39%, 8%, 1));
}

::selection {
  background: hsla(142, 86%, 56%, 0.25);
  color: hsl(var(--foreground));
}

.grid-bg {
  background-image:
    linear-gradient(hsla(180, 30%, 80%, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, hsla(180, 30%, 80%, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

.panel {
  background: linear-gradient(180deg, hsla(224, 36%, 14%, 0.92), hsla(224, 30%, 10%, 0.92));
  border: 1px solid hsla(var(--border), 0.7);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.glow-green {
  box-shadow: 0 0 0 1px hsla(142, 86%, 56%, 0.16), 0 0 18px hsla(142, 86%, 56%, 0.2);
}

.glow-red {
  box-shadow: 0 0 0 1px hsla(357, 84%, 58%, 0.16), 0 0 18px hsla(357, 84%, 58%, 0.2);
}

.glow-yellow {
  box-shadow: 0 0 0 1px hsla(47, 100%, 55%, 0.16), 0 0 18px hsla(47, 100%, 55%, 0.2);
}

.neon-border {
  position: relative;
}

.neon-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, hsla(142, 86%, 56%, 0.5), hsla(357, 84%, 58%, 0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.radar-shell {
  position: relative;
  width: min(100%, 280px);
  aspect-ratio: 1;
  border-radius: 9999px;
  background:
    radial-gradient(circle at center, hsla(142, 86%, 56%, 0.15) 0%, hsla(142, 86%, 56%, 0.06) 28%, transparent 29%),
    radial-gradient(circle at center, transparent 0 44%, hsla(180, 30%, 70%, 0.08) 44% 45%, transparent 45%),
    radial-gradient(circle at center, transparent 0 64%, hsla(180, 30%, 70%, 0.08) 64% 65%, transparent 65%),
    radial-gradient(circle at center, hsla(224, 30%, 10%, 0.9), hsla(224, 30%, 8%, 0.95));
  border: 1px solid hsla(var(--border), 0.9);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.radar-shell::before,
.radar-shell::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 50%;
  height: 1px;
  transform-origin: left center;
}

.radar-shell::before {
  background: linear-gradient(90deg, hsla(142, 86%, 56%, 0.9), transparent);
  animation: sweep 3.4s linear infinite;
}

.radar-shell::after {
  width: 1px;
  height: 50%;
  background: linear-gradient(180deg, hsla(357, 84%, 58%, 0.55), transparent);
  transform-origin: center top;
  animation: pulse-ray 2.2s ease-in-out infinite;
}

.radar-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 49.5%, hsla(180, 30%, 70%, 0.08) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, hsla(180, 30%, 70%, 0.08) 50%, transparent 50.5%);
}

.radar-blip {
  position: absolute;
  border-radius: 9999px;
  background: hsla(142, 86%, 56%, 0.9);
  box-shadow: 0 0 12px hsla(142, 86%, 56%, 0.65);
  animation: blip 2.4s ease-in-out infinite;
}

.scanline {
  position: relative;
  overflow: hidden;
}

.scanline::after {
  content: "";
  position: absolute;
  inset: -100% 0 auto;
  height: 40%;
  background: linear-gradient(180deg, transparent, hsla(180, 30%, 95%, 0.04), transparent);
  animation: scanline 8s linear infinite;
  pointer-events: none;
}

.signal-pulse {
  animation: signal-pulse 2s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(90deg, hsla(220, 18%, 16%, 1), hsla(220, 18%, 22%, 1), hsla(220, 18%, 16%, 1));
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.chart-wrap canvas {
  border-radius: 0.75rem;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: hsla(var(--border), 0.9);
  border-radius: 9999px;
}

::-webkit-scrollbar-track {
  background: hsla(var(--muted), 0.5);
}

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

@keyframes pulse-ray {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scaleY(0.9); }
  50% { opacity: 1; transform: translate(-50%, -50%) scaleY(1); }
}

@keyframes blip {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes signal-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.92; }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(500%); }
}
