/* ============================================================
   KarosFlow — node graph styling
   ============================================================ */
.kf-root {
  position: relative; width: 100%; height: 100%;
  overflow: hidden; cursor: grab;
  background:
    radial-gradient(circle at 50% 40%, rgba(245,180,0,.05), transparent 60%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #06060a;
  background-size: auto, 28px 28px, 28px 28px, auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  touch-action: none; user-select: none;
}
.kf-root.panning { cursor: grabbing; }

.kf-viewport { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.kf-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.kf-nodes { position: absolute; top: 0; left: 0; }

.kf-edge { fill: none; stroke: rgba(245,180,0,.45); stroke-width: 1.6; }
.kf-edge.anim {
  stroke-dasharray: 7 7;
  animation: kf-flow 1s linear infinite;
}
@keyframes kf-flow { to { stroke-dashoffset: -28; } }
.kf-pulse { fill: #ffd75e; filter: drop-shadow(0 0 6px var(--gold)); }

.kf-node {
  position: absolute; width: 188px;
  background: linear-gradient(160deg, #14141a, #0b0b0f);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 13px 15px; cursor: grab;
  box-shadow: 0 10px 30px -16px rgba(0,0,0,.8);
  transition: border-color .2s, box-shadow .2s, transform .05s;
  z-index: 2;
}
.kf-node:hover { border-color: rgba(245,180,0,.5); box-shadow: 0 0 0 1px rgba(245,180,0,.15), 0 16px 40px -18px rgba(245,180,0,.4); }
.kf-node.dragging { cursor: grabbing; z-index: 10; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 20px 50px -16px rgba(245,180,0,.5); }
/* playground: active / done states driven externally */
.kf-node.pg-active { border-color: var(--gold) !important; box-shadow: 0 0 0 1px var(--gold), 0 0 36px -4px var(--gold-glow); animation: pgPulse 1s ease-in-out infinite; }
.kf-node.pg-done { border-color: rgba(46,193,107,.6) !important; }
.kf-node.pg-done .kf-status { background: #2ec16b !important; box-shadow: 0 0 8px #2ec16b; }
.kf-node.pg-idle { opacity: .4; }
@keyframes pgPulse { 0%,100% { box-shadow: 0 0 0 1px var(--gold), 0 0 30px -6px var(--gold-glow); } 50% { box-shadow: 0 0 0 1px var(--gold), 0 0 48px 2px var(--gold-glow); } }
.kf-edge.pg-hot { stroke: var(--gold) !important; stroke-width: 2.4; filter: drop-shadow(0 0 4px var(--gold-glow)); }
.kf-node-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.kf-ic { width: 22px; height: 22px; display: grid; place-items: center; color: var(--gold); }
.kf-ic svg { width: 16px; height: 16px; }
.kf-tag { font-family: var(--f-mono); font-size: .58rem; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); flex: 1; }
.kf-status { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.kf-status.live { background: #2ec16b; box-shadow: 0 0 8px #2ec16b; animation: pulse 1.6s infinite; }
.kf-status.warn { background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: pulse 1.6s infinite; }
.kf-status.idle { background: #4a4a55; }
.kf-node-title { font-family: var(--f-display); font-weight: 600; font-size: .95rem; color: #fff; line-height: 1.15; }
.kf-node-sub { font-family: var(--f-mono); font-size: .68rem; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.kf-node-metric { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.kf-node-metric span { font-family: var(--f-mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.kf-node-metric b { font-family: var(--f-mono); font-size: .82rem; color: var(--gold); }

/* node kind accents */
.kf-agent   { border-top: 2px solid #8b5cf6; }
.kf-agent   .kf-ic, .kf-agent .kf-node-metric b { color: #a78bfa; }
.kf-api     { border-top: 2px solid #38bdf8; }
.kf-api     .kf-ic, .kf-api .kf-node-metric b { color: #56c7f5; }
.kf-route   { border-top: 2px solid var(--gold); }
.kf-route   .kf-ic, .kf-route .kf-node-metric b { color: var(--gold); }
.kf-compute { border-top: 2px solid #2ec16b; }
.kf-compute .kf-ic, .kf-compute .kf-node-metric b { color: #2ec16b; }
.kf-settle  { border-top: 2px solid #f97362; }
.kf-settle  .kf-ic, .kf-settle .kf-node-metric b { color: #f97362; }

.kf-controls { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 20; }
.kf-controls button {
  width: 36px; height: 36px; background: rgba(10,10,14,.9); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--gold); font-size: 1.1rem; line-height: 1;
  display: grid; place-items: center; backdrop-filter: blur(6px); transition: all .2s;
}
.kf-controls button:hover { border-color: var(--gold); background: var(--gold-faint); }
.kf-hint {
  position: absolute; left: 14px; bottom: 14px; z-index: 20;
  font-family: var(--f-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); pointer-events: none;
}
@media (max-width: 600px) { .kf-hint { display: none; } }
