.map-page {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.canvas-host {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.map-hud {
  position: fixed;
  z-index: 2;
}

.top-hud {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  pointer-events: none;
}

.top-hud > * {
  pointer-events: auto;
}

.brand-link {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-link h1 {
  margin: 0;
  font-size: 1.15rem;
}

.map-nav {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem;
  backdrop-filter: blur(8px);
}

.map-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
}

.map-nav a[aria-current="page"],
.map-nav a:hover {
  color: #ffffff;
  background: rgba(255, 85, 0, 0.18);
}

.map-nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 85, 0, 0.35);
}

.side-hud {
  top: 5.5rem;
  left: 1.25rem;
  width: min(280px, calc(100vw - 2.5rem));
  max-height: calc(100vh - 7rem);
  overflow: auto;
}

.side-hud h2 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.map-stats {
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.map-stats > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.3rem;
}

.map-stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.map-stats dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.legend {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.swatch.concept {
  background: #ff5500;
}
.swatch.focus {
  background: #ff8844;
}
.swatch.emotion {
  background: #ffffff;
}
.swatch.memory {
  background: #cc4400;
}
.swatch.theory {
  background: #ffb020;
}

.selected {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  line-height: 1.4;
  min-height: 2.5em;
}

.labels-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.node-label {
  position: absolute;
  transform: translate(-50%, -120%);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(232, 244, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(8, 12, 24, 0.45);
  border: 1px solid rgba(255, 85, 0, 0.28);
  transition: opacity 0.2s ease;
}

.node-label.dim {
  opacity: 0.25;
}

@media (max-width: 640px) {
  .side-hud {
    top: auto;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-height: 38vh;
  }

  .top-hud {
    flex-wrap: wrap;
  }
}
