/* ============================================================
   Skilltree — das Signature-Element.
   Themen sitzen auf Gitterpunkten des karierten Papiers, Kanten
   sind wie mit Bleistift gezogene Verbindungslinien. Gemeisterte
   Themen bekommen ein handgezeichnetes Häkchen (wie ein Lehrer-
   Korrekturzeichen).
   ============================================================ */

.skilltree-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  height: 70vh;
  min-height: 480px;
}

.skilltree-canvas {
  position: relative;
  width: 1100px;
  height: 1000px;
}

.skilltree-edges {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.skilltree-edge {
  stroke: var(--paper-line);
  stroke-width: 2;
  fill: none;
}

.skilltree-edge.edge-active {
  stroke: var(--pen-blue);
  stroke-dasharray: 4 3;
}

/* --- Themen-Knoten --- */
.topic-node {
  position: absolute;
  width: 168px;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-md);
  border: 2px solid var(--paper-line);
  background: var(--paper);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
  display: block;
  color: var(--ink);
}

.topic-node:hover {
  transform: translate(-50%, -50%) translateY(-2px);
  box-shadow: var(--shadow-raised);
}

.topic-node .strand-tag {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topic-node .topic-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-top: 2px;
  line-height: 1.25;
}

.topic-node .mastery-bar {
  height: 4px;
  background: var(--paper-line);
  border-radius: 2px;
  margin-top: var(--space-2);
  overflow: hidden;
}
.topic-node .mastery-fill {
  height: 100%;
  background: var(--sage);
  transition: width var(--transition-base);
}

/* Status-Varianten */
.topic-node.status-locked {
  opacity: 0.55;
  border-style: dashed;
  cursor: default;
}
.topic-node.status-locked::after {
  content: '🔒';
  position: absolute;
  top: -8px; right: -8px;
  font-size: 14px;
  background: var(--paper);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--paper-line);
}

.topic-node.status-available {
  border-color: var(--pen-blue);
}
.topic-node.status-available .topic-name { color: var(--pen-blue); }

.topic-node.status-in_progress {
  border-color: var(--gold);
  background: var(--gold-light);
}

.topic-node.status-mastered {
  border-color: var(--sage);
  background: var(--sage-light);
}
.topic-node.status-mastered::after {
  content: '✓';
  position: absolute;
  top: -10px; right: -10px;
  width: 24px; height: 24px;
  background: var(--sage);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  transform: rotate(-8deg); /* handgezeichnete Note statt perfekter Kreis */
  box-shadow: var(--shadow-card);
}

/* Legende */
.skilltree-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: var(--space-1);
}
