/* Krytz · Live data-flow DAG */

.dfdag {
  margin-top: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.dfdag::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(27, 42, 74,0.10) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(70% 60% at 50% 50%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 50%, #000 30%, transparent 100%);
  pointer-events: none;
  opacity: 0.7;
}

.dfdag-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.dfdag-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.dfdag-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  background: rgba(216,73,58,0.10);
  color: #B23A2D;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.dfdag-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #D8493A;
  animation: dfdag-liveblink 1.6s ease-in-out infinite;
}
@keyframes dfdag-liveblink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.8); }
}

.dfdag-stats { display: flex; gap: 20px; }
.dfdag-stat {
  display: flex; flex-direction: column; align-items: flex-end;
  font-family: var(--mono);
  line-height: 1;
}
.dfdag-stat .v {
  font-size: 22px;
  font-weight: 600;
  color: var(--g);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.dfdag-stat .l {
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dfdag-svg-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dfdag-svg {
  width: 100%;
  min-width: 880px;
  height: auto;
  display: block;
}

.dfdag-node text { user-select: none; }
.dfdag-node rect { transition: stroke 240ms ease; }
.dfdag-node.is-pulse rect { stroke: #1B2A4A; }
.dfdag-halo {
  animation: dfdag-halo 420ms ease-out forwards;
  transform-box: fill-box;
}
@keyframes dfdag-halo {
  0%   { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.06); }
}

.dfdag-legend {
  position: relative;
  display: flex; flex-wrap: wrap; gap: 22px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.dfdag-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lg-d {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--surface);
  border: 1.5px solid #0E1320;
}
.lg-d.s { background: #FFFFFF; }
.lg-d.p { background: #FFFFFF; border-color: #0E1320; }
.lg-d.f { background: #FFFFFF; border-color: #cdc4f0; border-style: dashed; }

@media (max-width: 900px) {
  .dfdag { padding: 18px; }
  .dfdag-stats { gap: 12px; }
  .dfdag-stat .v { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .dfdag-svg circle animateMotion,
  .dfdag-svg circle animate { display: none; }
  .dfdag-live-dot, .dfdag-halo { animation: none; }
}
