/* ── Panel layout ───────────────────────────────────────────────────────── */
/* Widen the shared Modal well beyond its default `large` (768px) so the tree
   has room to breathe both horizontally and vertically. */
.treeModal {
  max-width: min(1400px, calc(100vw - var(--space-8))) !important;
}

.panel {
  position: relative;
  display: flex;
  gap: 0;
  height: min(85vh, 900px);
}

.panelCanvas {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
}

/* ── Custom node face ───────────────────────────────────────────────────── */
.node {
  width: 190px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.35));
  border-left-width: 3px;
  background: var(--bg-secondary, #1e293b);
  font-size: 0.72rem;
  cursor: pointer;
  animation: latsGrow 0.25s ease-out;
}

@keyframes latsGrow {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.nodeExecuting {
  border-left-color: #38bdf8;
  animation: latsPulse 1.1s ease-in-out infinite;
}

@keyframes latsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.0); }
  50%      { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25); }
}

.nodePruned {
  opacity: 0.5;
  border-left-color: #7f1d1d;
}
.nodePruned .nodeLabel { text-decoration: line-through; }

.nodeTerminal {
  border-left-color: #fbbf24;
  animation: latsBurst 0.5s ease-out;
}

@keyframes latsBurst {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
  100% { box-shadow: 0 0 0 10px rgba(251, 191, 36, 0.0); }
}

.nodeBest {
  border-left-color: #86efac;
}

.nodeSelected {
  outline: 2px solid var(--accent, #60a5fa);
  outline-offset: 1px;
}

.nodeHead {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nodeGlyph { flex-shrink: 0; color: var(--text-muted, #94a3b8); }
.nodeLabel {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.nodeDanger { color: #f59e0b; flex-shrink: 0; }
.nodeCrown { color: #fbbf24; flex-shrink: 0; }

.nodeMeter {
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.2);
  margin: 4px 0;
  overflow: hidden;
}
.nodeMeterFill { height: 100%; transition: width 0.3s ease; }

.nodeMetaRow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted, #94a3b8);
}
.nodeValue { font-variant-numeric: tabular-nums; color: #cbd5e1; }
.nodeVisits { font-variant-numeric: tabular-nums; }
.nodeSignal {
  margin-left: auto;
  padding: 0 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.15);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nodeReflection {
  margin-top: 3px;
  color: #fca5a5;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handle { width: 6px; height: 6px; background: var(--text-muted, #64748b); border: none; }

/* ── Inspector ──────────────────────────────────────────────────────────── */
.inspector {
  flex: 0 0 300px;
  border-left: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
  padding: 12px;
  overflow-y: auto;
  font-size: 0.78rem;
  background: var(--bg-primary, #0f172a);
}
.inspectorHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.inspectorTitle {
  font-weight: 700;
  min-width: 0;
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.inspectorClose {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  flex-shrink: 0;
}
.inspectorSection { margin: 10px 0; }
.inspectorLabel {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 3px;
}
.inspectorCode {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
  padding: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
}
.inspectorKV {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}
.inspectorKV span:first-child { color: var(--text-muted, #94a3b8); }
.inspectorKV span:last-child { font-variant-numeric: tabular-nums; }

/* ── Scrubber ───────────────────────────────────────────────────────────── */
.scrubber {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 2px;
  font-size: 0.75rem;
}
.scrubber input[type='range'] { flex: 1 1 auto; }
.scrubberLabel {
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
