:root {
  /* UI & Root */
  --color-root: #0D5B5B;          /* Deep Teal */
  --color-page-bg: #f9fbfd;       /* Pale Sky */
  --color-ui-bg: #ffffff;
  --color-border: #e2e8f0;
  --color-control-bg: #f8fafc;
  --color-button: #0D5B5B;
  --color-button-hover: #0a4a4a;
  --color-text: #1e293b;
  --color-zoom-info: #475569;
  --color-separator: rgba(13, 91, 91, 0.15);
  --color-link: #94a3b8;

  /* Branch colors — 6 distinct, accessible hues */
  --branch-0: #4F46E5; /* Indigo */
  --branch-1: #0D9488; /* Teal */
  --branch-2: #DC2626; /* Red */
  --branch-3: #D97706; /* Amber */
  --branch-4: #7C3AED; /* Violet */
  --branch-5: #EA580C; /* Orange */
}

body {
  margin: 0;
  background: var(--color-page-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-text);
  overflow-x: hidden;
}

#title {
  width: 100%;
  padding: 20px;
  background: var(--color-ui-bg);
  font-size: clamp(20px, 5vw, 36px);
  font-weight: 700;
  color: var(--color-root);
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

#controls {
  padding: 12px 20px;
  background: var(--color-control-bg);
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
}

button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--color-button);
  color: #ffffff;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.2s;
}

button:hover {
  background: var(--color-button-hover);
}

#container {
  position: relative;
  padding: 40px;
  min-width: 2200px;
  transform-origin: top left;
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.node {
  position: absolute;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.25s ease, transform 0.2s;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.node:hover {
  transform: scale(1.02);
}

.node.level-3 {
  white-space: normal;
  max-width: 180px;
  text-align: center;
  line-height: 1.3;
}

/* Root */
.node.root {
  background: var(--color-root);
}

/* Branches — vibrant & distinct */
.node.branch-0 { background: var(--branch-0); }
.node.branch-1 { background: var(--branch-1); }
.node.branch-2 { background: var(--branch-2); }
.node.branch-3 { background: var(--branch-3); }
.node.branch-4 { background: var(--branch-4); }
.node.branch-5 { background: var(--branch-5); }

.toggle {
  width: 16px;
  font-weight: bold;
  text-align: center;
  color: #ffffff;
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

.separator {
  position: absolute;
  height: 1px;
  background: var(--color-separator);
  width: 140px;
}

#zoomInfo {
  font-size: 14px;
  align-self: center;
  color: var(--color-zoom-info);
  padding: 0 8px;
  font-weight: 500;
}

path {
  stroke: var(--color-link) !important;
  fill: none;
}