/* The idea "bullets": the pill node, its label, add/delete buttons */
.node {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid transparent;
  border-radius: 999px;
  background-image: linear-gradient(var(--node-bg), var(--node-bg)), var(--border-grad);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transition: left 0.5s cubic-bezier(.22,1,.36,1),
              top 0.5s cubic-bezier(.22,1,.36,1),
              background-image 0.3s ease,
              box-shadow 0.2s ease,
              transform 0.2s ease,
              width 0.12s ease-out,
              height 0.12s ease-out;
  padding: 14px 28px;
  width: max-content;
  min-width: 120px;
  max-width: 760px;
  text-align: center;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.node.root {
  font-size: 21px;
  font-weight: 300;
  padding: 20px 36px;
  min-width: 220px;
  max-width: 880px;
  letter-spacing: 0.2px;
}

.node.active {
  background-image: linear-gradient(var(--node-bg), var(--node-bg)),
                     linear-gradient(135deg, var(--gold-1), var(--gold-2), var(--gold-3));
  transform: translate(-50%, -50%) scale(1.05);
  animation: glow-pulse 1.8s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(var(--gold-glow-rgb),0.10),
                0 0 10px 1px rgba(var(--gold-glow-rgb),0.20),
                0 2px 10px rgba(0,0,0,0.08);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(var(--gold-glow-rgb),0.16),
                0 0 28px 7px rgba(var(--gold-glow-rgb),0.42),
                0 2px 10px rgba(0,0,0,0.08);
  }
}

.node.shake {
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { margin-left: 0; }
  20% { margin-left: -6px; }
  40% { margin-left: 5px; }
  60% { margin-left: -4px; }
  80% { margin-left: 3px; }
}

/* Placeholder shown for an empty bullet - rendered *after* the (empty)
   editable label so the real text-cursor lands before the hint phrase. */
.node.empty:after {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
  font-weight: 300;
  white-space: nowrap;
  pointer-events: none;
}

.label {
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
  overflow: visible;
  /* Grow on one line first (matches the node's own max-width), then wrap
     onto additional lines instead of truncating once that width is hit. */
  white-space: normal;
  word-wrap: break-word;
  outline: none;
}
.label[contenteditable="true"] {
  cursor: text;
}

/* "+" add-child button, docked to the bottom of the bullet */
.add-btn {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--node-border);
  background: var(--node-bg);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-50%) scale(0.8);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.node:hover .add-btn,
.node.active .add-btn {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
@media (hover: none) {
  .add-btn {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

/* "×" delete button, docked to the top of the bullet - near the
   connector line coming in from the parent above. */
.del-btn {
  position: absolute;
  left: 50%;
  top: -14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--node-border);
  background: var(--node-bg);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-50%) scale(0.8);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.node.deletable .del-btn {
  display: flex;
}
.node.deletable:hover .del-btn,
.node.deletable.active .del-btn {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.del-btn:hover {
  color: #c0392b;
  border-color: #c0392b;
}
@media (hover: none) {
  .node.deletable .del-btn {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}
