:root {
  color-scheme: dark;
  --ink: #eef6ff;
  --muted: #94a9bd;
  --subtle: #637890;
  --panel: rgba(5, 13, 26, 0.92);
  --panel-solid: #07111f;
  --line: rgba(137, 171, 207, 0.2);
  --cyan: #62c8ff;
  --cyan-bright: #bdeeff;
  --gold: #ffd15a;
  --orange: #ffad42;
  --blue: #629aff;
  --gray: #a7b0bc;
  --header-height: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  background: #030712;
  color: var(--ink);
  font-size: 16px;
}

button, input { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: relative;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(150px, 1fr) minmax(240px, 420px);
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  background: rgba(3, 9, 19, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid #7f9ebd;
  box-shadow: inset 0 0 0 4px #0a1930, 0 0 18px rgba(86, 188, 255, 0.35);
  background:
    radial-gradient(circle at 65% 35%, #ffe886 0 5%, transparent 6%),
    radial-gradient(circle at 50% 50%, #327eb1 0 34%, #122a4a 36% 50%, transparent 52%),
    linear-gradient(135deg, #4e98c9, #0d2746);
}

.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 0.92rem; letter-spacing: 0.02em; }
.brand small { margin-top: 4px; color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; }
.brand-version {
  margin-left: 0.38rem;
  color: #738395;
  font-size: 0.52rem;
  font-weight: 550;
  letter-spacing: 0.045em;
  text-transform: none;
  vertical-align: 0.08em;
}

.breadcrumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 0.92rem; }
.breadcrumb-location { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; }
.breadcrumb-location span:not(.breadcrumb-separator) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-separator { flex: 0 0 auto; color: var(--muted); }
.crumb { border: 0; padding: 6px 0; background: transparent; color: var(--cyan); cursor: pointer; }
.crumb:hover, .crumb:focus-visible { color: var(--cyan-bright); }

.search {
  position: relative;
  height: 38px;
  display: flex;
  border: 1px solid rgba(119, 170, 219, 0.35);
  border-radius: 8px;
  overflow: visible;
  background: rgba(9, 22, 41, 0.72);
}

.search:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(98, 200, 255, 0.12); }
.search input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 0 12px; color: var(--ink); background: transparent; }
.search input::placeholder { color: #6f8399; }
.search button { border: 0; padding: 0 14px; background: rgba(71, 135, 183, 0.18); color: var(--cyan-bright); cursor: pointer; }
.search button:hover { background: rgba(71, 135, 183, 0.3); }
.search > button[type="submit"] { border-radius: 0 8px 8px 0; }
.search-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: min(440px, calc(100vw - 24px));
  max-height: min(68vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(125, 176, 222, 0.38);
  border-radius: 10px;
  background: rgba(4, 12, 25, 0.98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.52);
}
.search-results[hidden] { display: none; }
.search-result {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.search-result:hover, .search-result:focus-visible { outline: none; background: rgba(76, 142, 194, 0.2); }
.search-result strong { font-size: 0.86rem; }
.search-result span { color: var(--muted); font-size: 0.73rem; line-height: 1.35; }
.search-empty { margin: 0; padding: 12px; color: var(--muted); font-size: 0.8rem; }

.mobile-info { display: none; }

.workspace {
  height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(350px, 26vw, 390px);
}

.map-region {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #061224 0%, #020713 58%, #050b18 100%);
}
.fixed-starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 45% 44%, rgba(36, 85, 139, 0.18), transparent 48%),
    radial-gradient(ellipse at 82% 75%, rgba(76, 45, 103, 0.08), transparent 40%);
}
.fixed-starfield svg { display: block; width: 100%; height: 100%; }
.map-viewport { position: absolute; inset: 0; z-index: 1; overflow: hidden; touch-action: none; cursor: grab; }
.map-viewport.is-dragging { cursor: grabbing; }
.map-camera { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform-style: preserve-3d; will-change: transform; }
.map-camera.is-galaxy-camera { transform-style: flat; will-change: auto; }
.map-world { position: relative; overflow: hidden; transform-origin: center; background: #07101e; transition: transform 220ms ease; will-change: transform; }

.galaxy-world {
  background: transparent;
  box-shadow: none;
  overflow: visible;
  will-change: auto;
}
.galaxy-world .sector-hotspot { transform: none; }
.source-galaxy-world .system-clouds { opacity: 0.58; }
.source-galaxy-world .galaxy-route { opacity: 0.78; }
.source-galaxy-world .galaxy-node[data-node-id^="source-"] .node-orbit {
  stroke: #f1bd67;
  stroke-dasharray: 3 3;
}
.source-galaxy-world .galaxy-node[data-node-id^="source-"] .node-sphere { stroke: #f3c778; }
.source-galaxy-world .sector-hotspot {
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
}
.galaxy-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.system-clouds { mix-blend-mode: screen; }
.galaxy-route {
  fill: none;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  opacity: 0.58;
}
.galaxy-route.internal { stroke: #dce8f4; stroke-width: 1.45; opacity: 0.72; }
.galaxy-route.local { stroke: #8295aa; }
.galaxy-route.linked { stroke: #f0c62f; stroke-width: 2.1; opacity: 0.78; }
.galaxy-route.restricted { stroke: #bb3345; stroke-width: 2.1; stroke-dasharray: 7 5; opacity: 0.82; }
.route-class-badge.fixed-map-symbol {
  transform-box: view-box;
  transform: none;
  pointer-events: auto;
  transition: opacity 140ms ease;
}
.galaxy-world:not(.map-detail-labels) .route-class-badge.hub-segment { opacity: 0; pointer-events: none; }
.route-class-badge rect { fill: rgba(6, 14, 26, 0.94); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.route-class-badge text { font-size: 8px; font-weight: 850; letter-spacing: 0.04em; paint-order: stroke; stroke: #07101f; stroke-width: 2px; }
.route-class-badge.race-progen rect, .class-code.race-progen { border-color: #f06a50; stroke: #f06a50; }
.route-class-badge.race-progen text { fill: #ff987f; }
.route-class-badge.race-terran rect, .class-code.race-terran { border-color: #63b9ff; stroke: #63b9ff; }
.route-class-badge.race-terran text { fill: #8bceff; }
.route-class-badge.race-jenquai rect, .class-code.race-jenquai { border-color: #c58aff; stroke: #c58aff; }
.route-class-badge.race-jenquai text { fill: #d9adff; }
.system-label {
  fill: #9cb0c5;
  font-size: 14px;
  font-style: italic;
  font-weight: 750;
  letter-spacing: 0.035em;
  paint-order: stroke;
  stroke: #07101f;
  stroke-width: 5px;
  stroke-linejoin: round;
  transition: opacity 140ms ease;
}
.fixed-map-symbol {
  transform-box: fill-box;
  transform-origin: center;
}
.system-label.fixed-map-symbol { transform: none; }
.galaxy-node.fixed-map-symbol {
  transform-box: view-box;
  transform: scale(var(--map-marker-scale, var(--map-inverse-scale, 1)));
}
.sector-label.fixed-map-symbol {
  transform-box: view-box;
  transform: none;
}
.map-detail-labels .system-label { opacity: 0; }
.node-orbit { fill: transparent; stroke: rgba(181, 213, 243, 0.3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.node-sphere { stroke: rgba(229, 243, 255, 0.7); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.node-shine { fill: rgba(255, 255, 255, 0.88); }
.galaxy-node .node-orbit, .galaxy-node .node-sphere { transition: stroke 140ms ease, stroke-width 140ms ease; }
.galaxy-node.is-hovered .node-orbit, .galaxy-node.is-selected .node-orbit {
  stroke: var(--cyan-bright);
  stroke-width: 3;
  filter: url(#soft-glow);
}
.galaxy-node.is-hovered .node-sphere, .galaxy-node.is-selected .node-sphere { stroke: #d8f4ff; stroke-width: 2; }
.sector-label {
  display: none;
  pointer-events: none;
  fill: #e5eff9;
  font-size: 16px;
  font-weight: 650;
  paint-order: stroke;
  stroke: #07101f;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.map-detail-labels .sector-label, .sector-label.is-selected { display: block; }
.sector-label.is-selected {
  fill: #ff4d5e;
  font-weight: 750;
  stroke: #07101f;
  stroke-width: 5px;
}

.sector-hotspot {
  position: absolute;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: scale(var(--map-inverse-scale, 1));
  transform-origin: center;
}

.sector-hotspot::before {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  min-width: max-content;
  max-width: 240px;
  padding: 7px 9px;
  border: 1px solid rgba(137, 184, 225, 0.42);
  border-radius: 7px;
  background: rgba(4, 13, 27, 0.95);
  color: #eaf5ff;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translate(-50%, 5px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}
.sector-hotspot:hover::before, .sector-hotspot:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }

.sector-hotspot:focus-visible { outline: none; }

.sector-map-background {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.sector-world {
  overflow: visible;
  background: transparent;
  transform-style: preserve-3d;
  backface-visibility: visible;
  --billboard-pitch: 0deg;
  --billboard-bearing: 0deg;
}
.sector-world.is-3d { pointer-events: none; }
.sector-world.is-3d .poi { pointer-events: auto; }
.sector-world.is-3d .sector-map-background { transform: translateZ(-300px); }

.sector-map-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 64% 48%, rgba(255, 242, 189, 0.28), transparent 5%),
    radial-gradient(circle at 35% 55%, rgba(68, 106, 188, 0.16), transparent 30%),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: auto, auto, 220px 220px, 220px 220px;
}

.decorative-object {
  position: absolute;
  pointer-events: none;
  user-select: none;
  transform: rotateZ(var(--billboard-bearing)) rotateX(var(--billboard-pitch));
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;
  filter: drop-shadow(0 18px 35px rgba(0,0,0,0.45));
}
.decorative-earth { width: 500px; margin-left: -250px; margin-top: -250px; opacity: 0.96; }
.decorative-station { width: 54px; margin-left: -27px; margin-top: -27px; }
.decorative-earth-station { width: 88px; margin-left: -44px; margin-top: -44px; }
.decorative-loki { width: 74px; margin-left: -37px; margin-top: -37px; }
.decorative-new-edinburgh { width: 205px; margin-left: -102px; margin-top: -102px; }
.decorative-loch-ness { width: 66px; margin-left: -33px; margin-top: -33px; }
.decorative-loch-brae { width: 38px; margin-left: -19px; margin-top: -19px; }

.sector-source-art {
  position: absolute;
  z-index: 0;
  height: auto;
  max-height: 190px;
  pointer-events: none;
  user-select: none;
  --rendered-point-z: 0px;
  transform: translate3d(-50%, -50%, var(--rendered-point-z)) rotateZ(var(--billboard-bearing)) rotateX(var(--billboard-pitch));
  transform-origin: center;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.46));
  transition: opacity 150ms ease, filter 150ms ease;
}
.sector-source-art.source-art-station { filter: drop-shadow(0 0 12px rgba(100, 207, 255, 0.34)); }
.sector-world.is-3d .sector-source-art { --rendered-point-z: var(--point-z, 0px); }

.poi {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gray);
  text-align: left;
  cursor: pointer;
  --rendered-point-z: 0px;
  transform: translate3d(-12px, -12px, calc(var(--rendered-point-z) + var(--selection-lift, 0px))) scale(var(--map-inverse-scale, 1));
  transform-origin: 12px 12px;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;
}
.sector-world.is-3d .poi { --rendered-point-z: var(--point-z, 0px); }

.poi-billboard {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  transform: rotateZ(var(--billboard-bearing)) rotateX(var(--billboard-pitch));
  transform-origin: center;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;
}

.poi:hover, .poi:focus-visible { z-index: 50; outline: none; background: transparent; box-shadow: none; }
.poi.is-selected { --selection-lift: 12px; z-index: 100; outline: none; background: transparent; box-shadow: none; }
.poi-marker { width: 18px; height: 18px; display: grid; place-items: center; }
.poi-icon { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 0 4px rgba(80, 208, 255, 0.42)); }
.poi-label { position: absolute; left: calc(100% + 3px); top: 50%; min-width: max-content; transform: translateY(-50%); pointer-events: none; font-size: 14px; line-height: 1.1; font-weight: 600; text-shadow: 0 1px 2px #000, 0 0 5px #000; }
.poi-label[data-placement="left"] { left: auto; right: calc(100% + 3px); top: 50%; bottom: auto; transform: translateY(-50%); text-align: right; }
.poi-label[data-placement="above"] { left: 50%; right: auto; top: auto; bottom: calc(100% + 4px); transform: translateX(-50%); text-align: center; }
.poi-label[data-placement="below"] { left: 50%; right: auto; top: calc(100% + 4px); bottom: auto; transform: translateX(-50%); text-align: center; }
.poi-label[data-placement="upper-right"] { left: calc(100% + 3px); right: auto; top: auto; bottom: calc(50% + 3px); transform: none; text-align: left; }
.poi-label[data-placement="upper-left"] { left: auto; right: calc(100% + 3px); top: auto; bottom: calc(50% + 3px); transform: none; text-align: right; }
.poi-label[data-placement="lower-right"] { left: calc(100% + 3px); right: auto; top: calc(50% + 3px); bottom: auto; transform: none; text-align: left; }
.poi-label[data-placement="lower-left"] { left: auto; right: calc(100% + 3px); top: calc(50% + 3px); bottom: auto; transform: none; text-align: right; }
.poi-label[data-placement="right-far"] { left: calc(100% + 22px); right: auto; top: 50%; bottom: auto; transform: translateY(-50%); text-align: left; }
.poi-label[data-placement="left-far"] { left: auto; right: calc(100% + 22px); top: 50%; bottom: auto; transform: translateY(-50%); text-align: right; }
.poi-label[data-placement="above-far"] { left: 50%; right: auto; top: auto; bottom: calc(100% + 22px); transform: translateX(-50%); text-align: center; }
.poi-label[data-placement="below-far"] { left: 50%; right: auto; top: calc(100% + 22px); bottom: auto; transform: translateX(-50%); text-align: center; }
.map-world.hide-labels .poi-label { display: none; }
.map-world.hide-labels .poi.is-selected .poi-label { display: block; }
.poi.is-selected .poi-label {
  visibility: visible !important;
  color: #ff4d5e !important;
  font-weight: 750;
  text-shadow: 0 1px 2px #000, 0 0 4px #000, 0 0 9px rgba(255, 30, 54, 0.36);
}
.poi-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 12;
  display: grid;
  gap: 5px;
  min-width: 210px;
  padding: 11px 12px;
  border: 1px solid rgba(137, 184, 225, 0.45);
  border-radius: 9px;
  background: #040d1b;
  color: #e8f4ff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, 5px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}
.poi-tooltip strong { color: #ffffff; font-size: 14px; }
.poi-tooltip span { color: #aec1d4; font-size: 12px; font-weight: 550; }
.poi-tooltip b { color: var(--cyan); font-size: 10px; letter-spacing: 0.08em; }
.poi:hover .poi-tooltip, .poi:focus-visible .poi-tooltip { opacity: 1; transform: translate(-50%, 0); }
.poi-tooltip[data-placement="below"] {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, -5px);
}
.poi:hover .poi-tooltip[data-placement="below"], .poi:focus-visible .poi-tooltip[data-placement="below"] { transform: translate(-50%, 0); }
.poi-tooltip[data-placement="right"] {
  left: calc(100% + 8px);
  top: 50%;
  bottom: auto;
  transform: translate(-5px, -50%);
}
.poi:hover .poi-tooltip[data-placement="right"], .poi:focus-visible .poi-tooltip[data-placement="right"] { transform: translate(0, -50%); }
.poi-tooltip[data-placement="left"] {
  left: auto;
  right: calc(100% + 8px);
  top: 50%;
  bottom: auto;
  transform: translate(5px, -50%);
}
.poi:hover .poi-tooltip[data-placement="left"], .poi:focus-visible .poi-tooltip[data-placement="left"] { transform: translate(0, -50%); }
.poi[data-type="hidden"] { color: #83bcff; }
.poi[data-type="nav"], .poi[data-type="planet"] { color: #d5dde6; }
.poi[data-type="gate"], .poi[data-type="station"] { color: #e6eee8; }
.poi[data-affiliation="terran"] { color: #f3d765; }
.poi:hover .poi-label, .poi:focus-visible .poi-label { color: #ffffff; }
.poi[data-type="hidden"] .poi-icon {
  filter: brightness(0.82) contrast(1.28) saturate(1.08) drop-shadow(0 0 3px rgba(73, 156, 255, 0.42));
}
.poi[data-type="nav"] .poi-icon, .poi[data-type="planet"] .poi-icon {
  filter: grayscale(1) brightness(0.82) contrast(1.55) drop-shadow(0 0 3px rgba(220, 232, 243, 0.4));
}
.poi[data-type="gate"] .poi-icon {
  filter: hue-rotate(72deg) saturate(1.45) brightness(0.64) contrast(2.05) drop-shadow(0 0 3px rgba(72, 238, 117, 0.42));
}
.poi[data-type="station"] .poi-icon {
  filter: hue-rotate(34deg) saturate(1.4) brightness(0.6) contrast(2.15) drop-shadow(0 0 3px rgba(72, 238, 117, 0.42));
}
.poi[data-affiliation="terran"] .poi-icon {
  filter: sepia(1) saturate(2.6) hue-rotate(355deg) brightness(0.82) contrast(1.85) drop-shadow(0 0 3px rgba(244, 202, 52, 0.48));
}

.poi.is-filtered-out, .sector-source-art.is-filtered-out, .galaxy-node.is-filtered-out, .sector-label.is-filtered-out {
  opacity: 0.12;
}
.sector-hotspot.is-filtered-out { opacity: 0.08; }
.poi.is-selected,
.sector-source-art.is-selected,
.galaxy-node.is-selected,
.sector-label.is-selected,
.sector-hotspot.is-selected { opacity: 1 !important; }
.poi.is-filter-match .poi-icon { filter: drop-shadow(0 0 7px rgba(255, 213, 78, 0.9)); }
.galaxy-node.is-filter-match .node-orbit { stroke: #ffd54e; stroke-width: 3; }

.map-tools {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 8;
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: rgba(5, 13, 26, 0.88);
  box-shadow: 0 8px 24px rgba(0,0,0,0.32);
}

.map-tools button { width: 42px; height: 40px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 1.15rem; cursor: pointer; }
.map-tools button:last-child { border-bottom: 0; }
.map-tools button:hover, .map-tools button:focus-visible { background: rgba(90, 167, 224, 0.18); outline: none; }

.layer-tools {
  position: absolute;
  z-index: 8;
  left: 70px;
  top: 16px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 13, 26, 0.88);
  color: var(--muted);
  font-size: 0.82rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}
.layer-tools[hidden] { display: none; }
.layer-tools label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.layer-tools input { accent-color: var(--cyan); }
.layer-tools > [hidden] { display: none !important; }
.view-toggle, .galaxy-view-toggle { display: inline-flex; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.view-toggle button, .galaxy-view-toggle button, .clear-filter {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.view-toggle button, .galaxy-view-toggle button { padding: 0 9px; }
.view-toggle button[aria-pressed="true"], .galaxy-view-toggle button[aria-pressed="true"] { background: rgba(92, 181, 238, 0.23); color: #e9f7ff; }
.galaxy-view-toggle button:last-child[aria-pressed="true"] { background: rgba(221, 163, 75, 0.22); color: #ffd88f; }
.filter-toggle {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 19, 36, 0.88);
  color: #dcecff;
  cursor: pointer;
}
.filter-toggle:hover, .filter-toggle[aria-expanded="true"] { border-color: rgba(98, 200, 255, 0.58); background: rgba(62, 124, 171, 0.22); }
.filter-toggle span { min-width: 17px; margin-left: 5px; padding: 1px 5px; border-radius: 999px; background: var(--gold); color: #151005; font-size: 0.65rem; font-weight: 800; }
.filter-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  width: min(440px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(125, 176, 222, 0.38);
  border-radius: 10px;
  background: rgba(4, 12, 25, 0.98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
}
.filter-panel[hidden] { display: none; }
.filter-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.filter-heading strong { color: #e8f3ff; font-size: 0.8rem; }
.filter-heading span { color: var(--subtle); font-size: 0.7rem; }
.filter-criteria { display: grid; gap: 8px; }
.filter-criterion { display: grid; grid-template-columns: minmax(0, 1fr) 92px 30px; gap: 7px; align-items: center; }
.filter-panel select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 7px;
  background: #09182a;
  color: var(--ink);
}
.filter-panel select:disabled { opacity: 0.42; }
.remove-filter {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  cursor: pointer;
}
.remove-filter:hover { color: #ff7280; border-color: rgba(255, 92, 108, 0.55); }
.add-filter, .clear-filters { min-height: 32px; border: 1px solid var(--line); border-radius: 7px; background: rgba(46, 83, 118, 0.2); color: var(--ink); cursor: pointer; }
.add-filter { border-style: dashed; background: rgba(33, 72, 108, 0.16); color: var(--cyan-bright); }
.filter-panel p { margin: 2px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.add-filter:hover, .clear-filters:hover { background: rgba(46, 83, 118, 0.36); }

.map-status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 7;
  transform: translateX(-50%);
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(4, 11, 23, 0.76);
  font-size: 0.78rem;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}
.map-status.is-visible { opacity: 1; }

.inspector {
  position: relative;
  z-index: 12;
  min-width: 0;
  padding: 26px 24px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 40px rgba(0,0,0,0.2);
}

.sheet-handle { display: none; }
.eyebrow { margin-bottom: 9px; color: var(--cyan); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.inspector h1, .inspector h2 { margin: 0; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.12; letter-spacing: -0.025em; }
.inspector h3 { margin: 24px 0 8px; color: #dcecff; font-size: 0.95rem; }
.inspector p { color: var(--muted); line-height: 1.58; }
.inspector ul { margin: 8px 0; padding-left: 19px; color: var(--muted); line-height: 1.5; }
.inspector li + li { margin-top: 5px; }
.place-header { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 19px; border-bottom: 1px solid rgba(137, 171, 207, 0.14); }
.place-mark { width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(132, 185, 232, 0.3); border-radius: 15px; background: linear-gradient(145deg, rgba(30, 76, 116, 0.44), rgba(9, 23, 42, 0.68)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.18); }
.place-mark img { width: 38px; height: 38px; object-fit: contain; }
.place-title { min-width: 0; flex: 1; }
.place-title .eyebrow { margin: 1px 0 5px; font-size: 0.65rem; letter-spacing: 0.13em; }
.place-title h1 { overflow-wrap: anywhere; }
.place-location { margin: 6px 0 0 !important; color: #8fa8bf !important; font-size: 0.8rem; line-height: 1.35 !important; }
.coordinate-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 0; padding: 10px 10px 10px 12px; border: 1px solid rgba(137, 171, 207, 0.2); border-radius: 10px; background: rgba(18, 40, 64, 0.36); }
.coordinate-field > div { min-width: 0; display: grid; gap: 3px; }
.coordinate-field > div > span { color: var(--subtle); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.coordinate-field code { overflow: hidden; color: #dcecff; font: 600 0.76rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.source-coordinate-card { display: grid; gap: 7px; margin: 16px 0; }
.source-coordinate-card div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 11px; border: 1px solid rgba(137, 171, 207, 0.18); border-radius: 8px; background: rgba(18, 40, 64, 0.28); }
.source-coordinate-card dt { color: var(--subtle); font-size: 0.67rem; letter-spacing: 0.06em; text-transform: uppercase; }
.source-coordinate-card dd { margin: 0; color: #dcecff; font: 600 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: right; }
.copy-coordinates { flex: 0 0 auto; height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid rgba(104, 177, 235, 0.34); border-radius: 7px; background: rgba(48, 106, 151, 0.2); color: #9edaff; font-size: 0.68rem; cursor: pointer; }
.copy-coordinates:hover { border-color: rgba(104, 196, 255, 0.66); background: rgba(48, 106, 151, 0.34); }
.copy-coordinates.is-copied { border-color: rgba(103, 218, 143, 0.62); color: #8ff1ae; background: rgba(42, 122, 75, 0.22); }
.copy-coordinates svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.45; }
.place-facts { display: grid; gap: 0; margin: 14px 0 0; }
.place-facts div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(137, 171, 207, 0.1); }
.place-facts dt { color: var(--subtle); font-size: 0.68rem; }
.place-facts dd { margin: 0; color: #d8e7f5; font-size: 0.78rem; text-align: right; }
.place-section { margin-top: 22px; }
.place-section > h2 { margin: 0 0 10px; color: #dcecff; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.connection-list { display: grid; gap: 7px; }
.connection-row { min-height: 48px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px; border: 1px solid rgba(137, 171, 207, 0.16); border-radius: 10px; background: rgba(16, 35, 58, 0.34); }
.connection-glyph { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(49, 123, 175, 0.24); color: #81d2ff; font-size: 0.9rem; }
.connection-row > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.connection-row strong { overflow: hidden; color: #e3effb; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.connection-row small { color: var(--subtle); font-size: 0.67rem; }
.connection-row button { min-height: 30px; padding: 0 9px; border: 1px solid rgba(91, 188, 245, 0.42); border-radius: 7px; background: rgba(51, 129, 180, 0.24); color: #bdeeff; font-size: 0.7rem; font-weight: 700; cursor: pointer; }
.connection-row button:hover { background: rgba(51, 129, 180, 0.4); }
.connection-unavailable { padding-right: 4px; }
.place-list { display: grid; gap: 6px; margin: 0 !important; padding: 0 !important; list-style: none; font-size: 0.78rem; }
.place-list li { padding: 7px 9px; border-radius: 7px; background: rgba(20, 43, 68, 0.24); }
.place-list li + li { margin-top: 0; }
.place-notes { padding-top: 16px; border-top: 1px solid rgba(137, 171, 207, 0.14); }
.place-notes h2, .place-notes h3 { margin: 14px 0 7px; color: #dcecff; font-size: 0.84rem; letter-spacing: 0; text-transform: none; }
.place-notes p { margin: 8px 0; font-size: 0.8rem; }
.trader-list { list-style: none; padding-left: 0 !important; }
.trader-list li { display: grid; gap: 2px; padding: 7px 0; border-bottom: 1px solid rgba(137, 171, 207, 0.12); }
.trader-list li::before { display: none; }
.trader-list small { color: var(--subtle); font-size: 0.72rem; }
.faction-logo { float: right; width: 36px; height: 36px; object-fit: contain; margin: 0 0 10px 12px; }
.sector-service-stats { margin: 18px 0 12px; }
.sector-stations { margin-top: 24px; }
.sector-stations > h3 { margin-bottom: 10px; }
.station-card {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(127, 174, 216, 0.3);
  border-radius: 10px;
  background: rgba(8, 20, 37, 0.72);
}
.station-card header { display: flex; align-items: center; gap: 10px; }
.station-card header div { min-width: 0; }
.station-card h2 { margin: 0; color: #f0f7ff; font-size: 1rem; line-height: 1.2; }
.station-card header p { margin: 3px 0 0; color: var(--cyan); font-size: 0.72rem; line-height: 1.3; }
.station-card h3 { margin: 15px 0 7px; color: var(--subtle); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; }
.station-faction-logo { flex: 0 0 auto; width: 34px; height: 34px; object-fit: contain; }
.station-card .chip-list { gap: 5px; }
.station-card .chip-list span { padding: 4px 7px; font-size: 0.7rem; }
.station-card .trader-list { margin: 0; }
.compact-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; margin: 0 !important; padding: 0 !important; list-style: none; font-size: 0.76rem; }
.compact-list li { min-width: 0; overflow-wrap: anywhere; }
.station-empty { margin: 0 !important; color: var(--subtle) !important; font-size: 0.76rem; }
.station-map-action {
  width: 100%;
  min-height: 34px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(48, 104, 148, 0.2);
  color: #dceeff;
  cursor: pointer;
}
.station-map-action:hover { background: rgba(48, 104, 148, 0.34); }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-list span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: #c7d8e8; background: rgba(36, 70, 103, 0.22); font-size: 0.75rem; }
.hint { color: var(--subtle) !important; font-size: 0.84rem; }
.metadata { margin: 20px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.metadata div { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(23, 45, 70, 0.2); }
.metadata dt { color: var(--subtle); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.metadata dd { margin: 5px 0 0; color: var(--ink); font-size: 0.9rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0; }
.stats div { padding: 12px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center; background: rgba(20, 42, 67, 0.28); }
.stats dt { color: var(--subtle); font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stats dd { margin: 5px 0 0; color: var(--cyan-bright); font-size: 1.35rem; font-weight: 700; }

.route-key { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 20px 0; color: var(--muted); font-size: 0.76rem; }
.route-key span { display: inline-flex; align-items: center; gap: 7px; }
.route-swatch { width: 22px; height: 0; border-top: 2px solid #8295aa; }
.route-swatch.internal { border-color: #dce8f4; }
.route-swatch.linked { border-color: #f0c62f; }
.route-swatch.restricted { border-color: #bb3345; border-top-style: dashed; }
.class-route-key { margin: -3px 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(9, 24, 42, 0.54); }
.class-route-key h2 { margin: 0 0 9px; color: var(--subtle); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
.class-route-group { display: grid; grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: 5px; align-items: center; margin-top: 6px; color: #b9cadb; font-size: 0.68rem; }
.class-route-group > strong { color: var(--muted); font-size: 0.65rem; text-transform: uppercase; }
.class-route-group span { white-space: nowrap; }
.class-route-group b { display: inline-grid; place-items: center; min-width: 22px; height: 18px; margin-right: 3px; border: 1px solid currentColor; border-radius: 5px; background: rgba(3, 11, 21, 0.76); font-size: 0.65rem; }
.class-route-group.race-progen b { color: #ff987f; }
.class-route-group.race-terran b { color: #8bceff; }
.class-route-group.race-jenquai b { color: #d9adff; }
.sector-class-routes { margin: 16px 0 4px; }
.sector-class-routes h3 { margin: 0 0 8px; color: var(--subtle); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; }
.sector-class-routes ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.sector-class-routes li { display: flex; gap: 9px; align-items: center; color: #dce9f5; font-size: 0.76rem; }
.sector-class-routes li > span:last-child { display: grid; gap: 1px; }
.sector-class-routes li strong { font-size: 0.76rem; }
.sector-class-routes li small { color: var(--subtle); font-size: 0.68rem; }
.class-code { display: inline-grid; place-items: center; flex: 0 0 auto; width: 30px; height: 22px; border: 1px solid; border-radius: 6px; background: rgba(3, 11, 21, 0.76); font-size: 0.68rem; font-weight: 850; }

@media (max-width: 1120px) and (min-width: 821px) {
  .class-route-group { grid-template-columns: 44px repeat(3, auto); }
  .class-route-group span { font-size: 0; }
  .class-route-group b { margin-right: 0; font-size: 0.65rem; }
}

.primary-action, .secondary-action {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.primary-action { border: 1px solid #7ad6ff; background: #b9ebff; color: #07111f; }
.primary-action:hover { background: #d8f5ff; }
.secondary-action { border: 1px solid var(--line); background: rgba(43, 84, 120, 0.2); color: var(--ink); }
.secondary-action:hover { background: rgba(43, 84, 120, 0.34); }
.status-pill { display: inline-flex; margin-top: 16px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.74rem; }

@media (max-width: 820px) {
  :root { --header-height: 58px; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 10px; }
  .brand strong { font-size: 0.82rem; }
  .brand small { font-size: 0.64rem; }
  .brand-mark { width: 30px; height: 30px; }
  .breadcrumbs { display: none; }
  .search { height: 36px; }
  .search button { display: none; }
  .mobile-info { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: rgba(30, 64, 94, 0.24); cursor: pointer; }
  .workspace { display: block; }
  .map-region { width: 100%; height: 100%; }
  .inspector {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(68dvh, 620px);
    padding: 15px 20px 24px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 74px));
    transition: transform 220ms ease;
    box-shadow: 0 -20px 45px rgba(0,0,0,0.42);
  }
  .inspector.is-open { transform: translateY(0); }
  .sheet-handle { display: block; width: 58px; height: 18px; margin: -6px auto 12px; border: 0; background: transparent; cursor: pointer; }
  .sheet-handle::after { content: ""; display: block; width: 38px; height: 4px; margin: 7px auto; border-radius: 999px; background: #536981; }
  .map-tools { left: 10px; top: 10px; }
  .map-tools button { width: 40px; height: 38px; }
  .layer-tools { left: 60px; top: 10px; min-height: 40px; }
  .filter-panel { left: -50px; }
  .poi-label { font-size: 13px; }
  .system-label { font-size: 14px; }
}

@media (max-width: 520px) {
  .topbar { grid-template-columns: 36px 1fr 36px; }
  .brand { width: 36px; }
  .brand > span:last-child { display: none; }
  .search { width: 100%; }
  .layer-tools { gap: 9px; padding: 0 10px; }
  .sector-control:first-child { display: none !important; }
  .filter-panel { left: -50px; }
  .map-status { bottom: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

@media (hover: none) {
  .sector-hotspot::before, .poi-tooltip { display: none; }
}
