/* Draggable Nodes & Interactive Canvas Pan */
.lexis-draggable-node {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: transform;
  transition: border-color 0.12s ease;
}

.lexis-draggable-node:hover {
  border-color: #3b82f6;
}

.lexis-draggable-node.is-dragging {
  cursor: grabbing !important;
  z-index: 50 !important;
  border-color: #60a5fa !important;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px #60a5fa !important;
  transition: none !important;
  will-change: transform;
}

.canvas-pannable {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.canvas-pannable.is-panning {
  cursor: grabbing !important;
}

/* LLM Server Node Deep-Dive Pulse Indicator */
#lexis-node-llm {
  position: relative;
}

#lexis-node-llm::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 10px;
  border: 1px dashed rgba(96, 165, 250, 0.45);
  pointer-events: none;
  animation: pulse-ring 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

/* VRAM Blocks Grid in Deep-Dive */
.vram-block-cell {
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid #1c2536;
  background-color: #11151f;
  color: #4b5563;
}

.vram-block-cell.is-free {
  background-color: #0e121a;
  border-color: #1a2230;
  color: #374151;
}

.vram-block-cell.is-active-r1 {
  background-color: rgba(96, 165, 250, 0.25);
  border-color: #60a5fa;
  color: #93c5fd;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.2);
}

.vram-block-cell.is-active-r2 {
  background-color: rgba(52, 211, 153, 0.25);
  border-color: #34d399;
  color: #a7f3d0;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.2);
}

.vram-block-cell.is-active-r3 {
  background-color: rgba(192, 132, 252, 0.25);
  border-color: #c084fc;
  color: #e9d5ff;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

.vram-block-cell.is-active-r4 {
  background-color: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #bae6fd;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.vram-block-cell.is-active-r5 {
  background-color: rgba(251, 191, 36, 0.25);
  border-color: #fbbf24;
  color: #fef08a;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

.vram-block-cell.is-active-r6 {
  background-color: rgba(244, 63, 94, 0.25);
  border-color: #f43f5e;
  color: #fecdd3;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.2);
}

.vram-block-cell.is-fragmented {
  background: repeating-linear-gradient(
    -45deg,
    rgba(239, 68, 68, 0.15),
    rgba(239, 68, 68, 0.15) 4px,
    rgba(239, 68, 68, 0.25) 4px,
    rgba(239, 68, 68, 0.25) 8px
  );
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* Appended LLM Under-The-Hood Branch */
#lexis-branch-llm {
  position: relative;
  z-index: 25;
}

#lexis-branch-llm:not(.hidden) {
  animation: branchFadeIn 0.15s ease-out forwards;
}

@keyframes branchFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.branch-connector-glow {
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.18), 0 0 50px rgba(59, 130, 246, 0.08);
}

/* 3-Zone Architecture Dynamic Cards & Token Stream */
.engine-pool-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(33, 43, 61, 0.8);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  transition: all 0.25s ease-out;
  animation: poolCardSlideIn 0.25s ease-out;
}

@keyframes poolCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.engine-pool-card.is-blocked {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  border-left-color: #ef4444;
}

.engine-batch-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(41, 53, 76, 0.9);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 8px 10px;
  transition: all 0.25s ease-out;
  animation: batchCardEnter 0.25s ease-out;
}

@keyframes batchCardEnter {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.engine-progress-bar {
  background: rgba(30, 41, 59, 0.7);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.engine-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.12s linear;
  box-shadow: 0 0 8px currentColor;
}

.streamed-token {
  display: inline-block;
  opacity: 0;
  animation: tokenFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin-right: 3px;
}

@keyframes tokenFadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.streamed-token.is-boundary {
  color: #34d399 !important;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

/* Remove default scrollbar on the 3 LLM deep-dive boxes */
#engine-pool-list,
#engine-batch-list,
#box-stream-tokens,
.no-scrollbar {
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE & Edge */
}

#engine-pool-list::-webkit-scrollbar,
#engine-batch-list::-webkit-scrollbar,
#box-stream-tokens::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Opera */
  width: 0 !important;
  height: 0 !important;
}
