/* v0.5：按学习阶段自下而上的知识塔。 */
.atlas-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
}

.edge-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.graph-transform {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  transform-origin: 0 0;
  will-change: transform;
}

.map-viewport {
  touch-action: none;
  contain: strict;
}

.tower-domain {
  position: absolute;
  border: 1px dashed rgba(255,255,255,.14);
  border-radius: 22px;
  background: rgba(7,16,24,.2);
  pointer-events: none;
}
.tower-domain.math { border-color: rgba(216,170,78,.34); background: rgba(216,170,78,.025); }
.tower-domain.cs { border-color: rgba(85,169,216,.34); background: rgba(85,169,216,.025); }
.tower-domain.ai { border-color: rgba(169,122,231,.34); background: rgba(169,122,231,.025); }

.tower-domain-title {
  position: absolute;
  left: 22px;
  bottom: 18px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: .95;
}
.tower-domain.math .tower-domain-title { color: var(--math); }
.tower-domain.cs .tower-domain-title { color: var(--cs); }
.tower-domain.ai .tower-domain-title { color: var(--ai); }

.tower-stage {
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px;
  background: rgba(7,17,25,.95);
  box-shadow: inset 0 0 28px rgba(0,0,0,.14), 0 12px 34px rgba(0,0,0,.13);
  contain: layout paint style;
}
.tower-stage.math { border-color: rgba(216,170,78,.34); }
.tower-stage.cs { border-color: rgba(85,169,216,.34); }
.tower-stage.ai { border-color: rgba(169,122,231,.34); }

.tower-stage-header {
  height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.075);
  background: rgba(255,255,255,.018);
}
.tower-stage-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.tower-stage.math .tower-stage-index { color: var(--math); }
.tower-stage.cs .tower-stage-index { color: var(--cs); }
.tower-stage.ai .tower-stage-index { color: var(--ai); }
.tower-stage-header h3 {
  margin: 0;
  color: #edf5f8;
  font-size: 14px;
  line-height: 1.2;
}
.tower-stage-header p {
  overflow: hidden;
  margin: 3px 0 0;
  color: #718895;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tower-stage-count {
  color: #78909f;
  font-size: 9px;
  white-space: nowrap;
}

.tower-node {
  display: grid;
  align-content: center;
  gap: 3px;
  position: absolute;
  padding: 7px 12px 7px 15px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: rgba(10,23,33,.985);
  text-align: left;
  cursor: pointer;
  transition: opacity 120ms ease, border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.tower-node::before {
  content: "";
  width: 3px;
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  border-radius: 0 3px 3px 0;
  background: currentColor;
  opacity: .9;
}
.tower-node.math { color: var(--math); border-color: rgba(216,170,78,.48); }
.tower-node.cs { color: var(--cs); border-color: rgba(85,169,216,.48); }
.tower-node.ai { color: var(--ai); border-color: rgba(169,122,231,.48); }
.tower-node strong {
  overflow: hidden;
  color: #eef5f8;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tower-node span {
  overflow: hidden;
  color: #6f8795;
  font-size: 7.8px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tower-node:hover,
.tower-node.selected,
.tower-node.neighbor {
  z-index: 6;
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #102633;
  box-shadow: 0 0 0 2px rgba(114,213,187,.07), 0 8px 20px rgba(0,0,0,.22);
}
.tower-node.practice { border-style: dashed; }
.tower-node.tool { border-radius: 999px; }
.tower-node.frontier { box-shadow: inset 0 0 0 2px rgba(169,122,231,.11); }
.tower-node.path-node { border-color: var(--accent); box-shadow: 0 0 14px rgba(114,213,187,.14); }
.tower-node.path-dimmed { opacity: .18; }
.tower-node.unrelated { opacity: .16; }

.tower-cluster-tag {
  color: #78909f;
}

.virtual-chunk,
.virtual-stage-label,
.virtual-node,
.knowledge-graph,
.edge-layer,
.domain-region,
.cluster-group,
.cluster-node-grid,
.knowledge-node {
  display: none !important;
}

@media (max-width: 760px) {
  .tower-stage-header h3 { font-size: 13px; }
  .tower-node strong { font-size: 10px; }
}
