.fullShell {
  display: flex;
  flex-direction: column;
  height: 100svh;
  overflow: hidden;
  color: var(--pf-ink);
}

.topBar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--pf-rule);
  background: #fff;
  z-index: 10;
}

.mapTitle {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.back {
  color: var(--pf-ink);
  font-family: var(--pf-mono);
  font-size: var(--pf-fs-mono);
  letter-spacing: var(--pf-track-mono);
  text-decoration: none;
  text-transform: uppercase;
}

.back:hover {
  color: var(--pf-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.headerRight {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* The page IS the canvas: the map fills everything under the top bar. */
.map {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.toggleGroup {
  display: inline-flex;
  border: 1px solid var(--pf-rule);
  border-radius: 0;
  overflow: hidden;
}

.toggleBtn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 14px;
  color: var(--pf-ink-muted);
  font-family: var(--pf-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.toggleBtn + .toggleBtn {
  border-left: 1px solid var(--pf-rule);
}

.toggleOn {
  background: var(--pf-ink);
  color: var(--pf-cream);
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.legendItem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--pf-ink-muted);
  font-family: var(--pf-mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.legendDrag {
  color: var(--pf-ink-faint);
  font-family: var(--pf-mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.swatchDone,
.swatchPlanned {
  width: 22px;
  height: 14px;
  border-radius: 0;
}

.swatchDone {
  border: 1.5px solid var(--pf-ink);
  background: #fff;
}

.swatchPlanned {
  border: 1.5px dashed var(--pf-ink-faint);
}

.swatchDep {
  width: 24px;
  height: 0;
  border-top: 2px dashed var(--pf-ink-faint);
}

/* .viewport does NOT clip, so the popup can never be cut off by the
   pannable canvas underneath it — only the canvas itself clips. */
.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
}

.canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-top: 1px solid var(--pf-rule);
  background: var(--pf-cream);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.canvas:active {
  cursor: grabbing;
}

.layer {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.zoomGroup {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pf-rule);
  border-radius: 0;
  overflow: hidden;
}

.zoomBtn,
.zoomVal {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--pf-ink-muted);
  font-family: var(--pf-mono);
  cursor: pointer;
}

.zoomBtn {
  padding: 7px 14px;
  font-size: 16px;
  line-height: 1;
}

.zoomVal {
  padding: 9px 10px;
  min-width: 56px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  border-inline: 1px solid var(--pf-rule);
}

.zoomBtn:hover,
.zoomVal:hover {
  color: var(--pf-ink);
  background: var(--pf-cream-2);
}

.mapSvg {
  display: block;
  overflow: visible;
}

.tickText,
.laneLabel,
.nowLabel,
.gateLabel,
.futureLabel {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tickText {
  font-family: var(--pf-mono);
  font-size: 16px;
  font-weight: 600;
  fill: var(--pf-ink-muted);
}

.laneLabel {
  font-family: var(--pf-sans);
  font-size: 17.5px;
  font-weight: 600;
  fill: var(--pf-ink);
  letter-spacing: -0.01em;
}

.gridLine,
.gridLineHorizontal {
  stroke: var(--pf-rule-soft);
  stroke-width: 1;
  stroke-dasharray: 6 4;
  opacity: 0.8;
}

.gridLineVertical {
  stroke: var(--pf-rule-soft);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}

.futureZone {
  fill: var(--pf-cream-2);
  opacity: 0.4;
}

.futureLabel {
  font-family: var(--pf-mono);
  font-size: 16px;
  font-weight: 600;
  fill: var(--pf-ink-muted);
}

.nowLine {
  stroke: var(--pf-ink);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  opacity: 0.55;
}

.nowLabel {
  font-family: var(--pf-mono);
  font-size: 16px;
  font-weight: 700;
  fill: var(--pf-ink);
}

.gateRect {
  fill: none;
  stroke: var(--pf-ink-muted);
  stroke-width: 1.5;
  stroke-dasharray: 8 6;
}

.gateLabel {
  font-size: 16px;
  fill: var(--pf-ink);
}

.thread {
  stroke: var(--pf-ink-ghost);
  stroke-width: 2;
}

.threadPlanned {
  stroke: var(--pf-ink-ghost);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.depEdge {
  fill: none;
  stroke: var(--pf-ink-faint);
  stroke-width: 1.7;
  stroke-dasharray: 4 4;
}

.depArrow {
  fill: var(--pf-ink-faint);
}

.nodeGroup {
  cursor: pointer;
  outline: none;
}

.nodeGroup:focus-visible rect {
  stroke-width: 2.5;
}

.nodeDone {
  fill: #fff;
  stroke: var(--pf-ink);
  stroke-width: 1.4;
}

.nodeGroup:hover .nodeDone {
  fill: var(--pf-cream-2);
}

.nodePlanned {
  fill: var(--pf-cream);
  stroke: var(--pf-ink-faint);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
}

.nodeGroup:hover .nodePlanned {
  stroke: var(--pf-ink-muted);
}

/* Secondary = level-2 nodes, only ever visible in the detailed view —
   lighter fill and a muted, thinner border keeps overview nodes dominant. */
.nodeDoneSecondary {
  fill: var(--pf-cream-2);
  stroke: var(--pf-ink-faint);
  stroke-width: 1.1;
}

.nodeGroup:hover .nodeDoneSecondary {
  fill: #fff;
  stroke: var(--pf-ink-muted);
}

.nodePlannedSecondary {
  fill: transparent;
  stroke: var(--pf-ink-ghost);
  stroke-width: 1.1;
  stroke-dasharray: 4 3;
}

.nodeGroup:hover .nodePlannedSecondary {
  stroke: var(--pf-ink-faint);
}

.nodeSelected {
  fill: var(--pf-ink);
  stroke: var(--pf-ink);
  stroke-width: 1.4;
}

.nodeText,
.nodeTextPlanned,
.nodeTextSecondary,
.nodeTextPlannedSecondary,
.nodeTextSelected {
  font-family: var(--pf-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  pointer-events: none;
}

.nodeText {
  fill: var(--pf-ink);
}

.nodeTextPlanned {
  fill: var(--pf-ink-muted);
}

.nodeTextSecondary {
  fill: var(--pf-ink-muted);
}

.nodeTextPlannedSecondary {
  fill: var(--pf-ink-faint);
}

.nodeTextSelected {
  fill: var(--pf-cream);
}

.popup {
  position: absolute;
  z-index: 10;
  padding: 18px 20px 20px;
  background: #fff;
  border: 1px solid var(--pf-ink);
  border-radius: 0;
  overflow-y: auto;
  cursor: auto;
}

.popupHead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.popupDate {
  color: var(--pf-ink-faint);
  font-family: var(--pf-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tagGate {
  padding: 2px 10px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--pf-ink);
  color: var(--pf-ink);
  font-family: var(--pf-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.popupClose {
  appearance: none;
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--pf-ink-muted);
  font-family: var(--pf-mono);
  font-size: 11px;
  letter-spacing: var(--pf-track-mono);
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.popupClose:hover {
  color: var(--pf-ink);
}

.popupTitle {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.popupBody {
  margin: 0;
  color: var(--pf-ink);
  font-size: 14.5px;
  line-height: 1.6;
}

.popupLinks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.popupLinks a {
  color: var(--pf-ink-muted);
  font-family: var(--pf-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-decoration: none;
  width: fit-content;
}

.popupLinks a:hover {
  color: var(--pf-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mapCaption {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 5;
  max-width: 620px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 0;
  background: rgba(251, 248, 242, 0.88);
  color: var(--pf-ink-faint);
  font-family: var(--pf-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.6;
  pointer-events: none;
}
