/* Editable atlas. The mobile world scrolls horizontally; handles alone capture touch. */
.project-map.interactive-map {
  display: block;
  height: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #2f3158;
  background: #0a0b14;
  border-radius: 20px;
}
.project-map.interactive-map:after {
  display: none;
}
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 17px 20px;
  border-bottom: 1px solid #282a41;
  background: #0d0d18;
}
.map-mode-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 12px var(--mono);
  letter-spacing: 0.02em;
  color: #bec2e0;
  white-space: nowrap;
}
.map-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #383b6c;
}
.map-tools {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.map-tools button,
.map-footer button,
.map-route-label {
  border: 1px solid #373a5b;
  background: #131526;
  color: #d1d5e9;
  border-radius: 999px;
  font-size: 13px;
  min-height: 36px;
  padding: 7px 12px;
}
.map-tools button:hover:not(:disabled),
.map-footer button:hover:not(:disabled) {
  border-color: #818cf8;
  background: #1d1f38;
}
.map-tools button:disabled,
.map-footer button:disabled {
  opacity: 0.5;
}
.map-tools button[aria-pressed="true"] {
  border-color: #383b6c;
  background: #1a1b32;
}
.map-route-label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #abb1d7;
}
.map-route-label select {
  font: inherit;
  background: #131526;
  color: #e2e4f1;
  border: 0;
  padding: 0;
  max-width: 80px;
}
.map-route-label select:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 4px;
}
.map-instructions {
  margin: 0;
  padding: 13px 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #afb4d8;
  border-bottom: 1px solid #1e203b;
}
.map-port-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  border: 1px solid #383b6c;
  border-radius: 50%;
  color: #818cf8;
}
.map-viewport {
  height: 650px;
  overflow: auto;
  position: relative;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #4e5381 #0a0b14;
  isolation: isolate;
}
.map-viewport::-webkit-scrollbar {
  width: 9px;
  height: 9px;
  background: #0a0b14;
}
.map-viewport::-webkit-scrollbar-thumb {
  background: #4e5381;
  border-radius: 10px;
}
.map-viewport:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: -3px;
}
.map-world {
  position: relative;
  width: 100%;
  min-width: 900px;
  height: 630px;
  background:
    radial-gradient(ellipse at center, #383b6c13, transparent 65%),
    radial-gradient(#51568740 0.8px, transparent 0.8px);
  background-size:
    auto,
    20px 20px;
}
.map-wires,
.map-draft-wire,
.map-node-layer,
.map-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-node-layer {
  pointer-events: none;
  z-index: 2;
}
.map-wires {
  z-index: 1;
  overflow: visible;
  fill: none;
}
.map-draft-wire {
  z-index: 3;
  pointer-events: none;
  fill: none;
  stroke: #aeb3d8;
  stroke-width: 2;
  stroke-dasharray: 5 6;
}
.map-particles {
  z-index: 4;
  pointer-events: none;
}
.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}
.map-card {
  width: 214px;
  padding: 0 16px 13px;
  border: 1px solid #474c76;
  border-radius: 16px;
  background: linear-gradient(145deg, #141628, #0c0d18);
  box-shadow: 0 6px 24px #0006;
  transition:
    box-shadow 0.18s,
    border-color 0.18s;
}
.map-card:hover,
.map-card:focus-within {
  border-color: #818cf8;
  box-shadow: 0 8px 30px #0008;
}
.map-card h3 {
  font: 500 14px/1.3 var(--sans);
  color: #e7e9f3;
  letter-spacing: -0.3px;
  margin: 13px 0 8px;
}
.map-card p {
  font: 12px/1.6 var(--mono);
  color: #b5badb;
  margin: 0 0 8px;
  min-height: 27px;
}
.map-drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: calc(100% + 32px);
  margin: 0 -16px;
  padding: 8px 13px;
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid #303356;
  border-radius: 16px 16px 0 0;
  background: #17192d;
  color: #b4b9db;
  font: 12px var(--mono);
  letter-spacing: 0.02em;
  cursor: grab;
  touch-action: none;
}
.drag-grip {
  width: 10px;
  height: 16px;
  background-image: radial-gradient(#9ea5d0 1.2px, transparent 1.3px);
  background-size: 5px 5px;
  opacity: 0.8;
}
.map-drag-handle:active,
.is-dragging .map-drag-handle {
  cursor: grabbing;
}
.map-node.is-dragging {
  z-index: 5;
  box-shadow:
    0 12px 40px #000a,
    0 0 0 1px #818cf8;
  border-color: #818cf8;
}
.map-open-case {
  padding: 6px 0;
  border: 0;
  background: none;
  color: #cdd1e7;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  min-height: 36px;
}
.map-open-case:hover {
  color: #fff;
}
.map-open-case span {
  margin-left: 15px;
}
.map-port {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 1px solid #818cf8;
  border-radius: 50%;
  background: #10111f;
  color: #a1a8d2;
  font: 18px/1 var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 0 0 4px #0c0c17;
}
.map-port:hover,
.map-port[aria-pressed="true"] {
  background: #383b6c;
  color: #090911;
  box-shadow: 0 0 0 4px #383b6c30;
}
.map-hub {
  width: 136px;
  height: 125px;
  border: 1px solid #383b6c;
  border-radius: 16px;
  background: #16182b;
}
.hub-handle {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 13px 7px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font: 500 13px var(--sans);
  color: #d0d3e8;
}
.hub-handle img {
  width: 40px;
  height: 40px;
  pointer-events: none;
}
.map-card.kind-lab,
.map-card.kind-personal {
  border-style: dashed;
  border-color: #3a3c57;
  background: #0b0c15;
}
.map-card.kind-lab .map-drag-handle,
.map-card.kind-personal .map-drag-handle {
  background: #101220;
  color: #babfde;
}
.map-world.is-connecting .map-card:hover {
  border-color: #bdc2df;
  background: #1c1e36;
}
.map-edge {
  cursor: pointer;
  outline: none;
}
.map-edge-hit {
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  fill: none;
}
.map-edge-line {
  stroke: #4a4e7a;
  stroke-width: 1.5;
  pointer-events: none;
  fill: none;
  transition: stroke 0.15s;
}
.map-edge:hover .map-edge-line,
.map-edge:focus-visible .map-edge-line {
  stroke: #acb2d7;
  stroke-width: 2.5;
}
.map-edge.selected .map-edge-line {
  stroke: #818cf8;
  stroke-width: 2.5;
}
.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 20px;
  border-top: 1px solid #2a2c4c;
  background: #0e0f1c;
  min-height: 60px;
}
.map-footer > span {
  font: 13px/1.7 var(--sans);
  color: #babfde;
}
.map-footer button {
  flex-shrink: 0;
}
.map-connections {
  border-top: 1px solid #272946;
  background: #0b0c15;
  padding: 0 20px;
}
.map-connections summary {
  font: 14px var(--sans);
  color: #c8cce4;
  cursor: pointer;
  padding: 15px 0;
  line-height: 1.8;
}
.map-connections summary > #map-edge-count {
  font: 12px var(--mono);
  margin-left: 8px;
  color: #a7add5;
}
.map-touch-hint {
  float: right;
  font: 12px/2 var(--sans);
  color: #9ea5d0;
}
.map-connection-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}
.map-connection-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 10px 0;
  border-top: 1px solid #262842;
  font-size: 14px;
  color: #b9bedd;
}
.map-connection-list li b {
  font-weight: 400;
  color: #818cf8;
  padding-inline: 6px;
}
.map-connection-list button {
  font-size: 13px;
  background: #151729;
  color: #d7daec;
  border: 1px solid #3f4269;
  border-radius: 10px;
  padding: 6px 12px;
  min-height: 36px;
  flex-shrink: 0;
}
.map-connection-list button:hover {
  border-color: #818cf8;
}
@media (max-width: 700px) {
  .map-toolbar {
    padding: 15px;
    gap: 13px;
  }
  .map-tools {
    gap: 6px;
  }
  .map-tools button,
  .map-route-label {
    min-height: 40px;
    padding: 7px 10px;
  }
  .map-instructions {
    padding: 12px 15px;
  }
  .map-viewport {
    height: 580px;
  }
  .map-world {
    height: 560px;
  }
  .map-card {
    width: 200px;
  }
  .map-card h3 {
    font-size: 13px;
  }
  .map-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 15px;
    gap: 10px;
  }
  .map-connections {
    padding-inline: 15px;
  }
  .map-touch-hint {
    display: block;
    float: none;
    margin-top: 5px;
  }
  .map-connection-list li {
    align-items: flex-start;
  }
  .map-port {
    width: 30px;
    height: 30px;
    right: -15px;
  }
  .map-hub {
    width: 126px;
    height: 118px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .map-card,
  .map-edge-line {
    transition: none;
  }
}
.map-open-case {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-open-case .icon {
  width: 15px;
  height: 15px;
}
