:host {
  --void: #090909;
  --map-surface: #101010;
  --map-line: #2b2926;
  --bone: #f1eee8;
  --map-muted: #b6b1aa;
  --ink: #FF4700;
  --map-hover: rgba(255, 71, 0, .10);
  --map-edge: #68685b;
  --workspace-shadow: none;
}
.map-page { font: 500 16px/1.4 var(--font-display); }
.map-page button, .map-page input, .map-page select, .map-page textarea { font-family: inherit; }
.map-page button { min-height: 44px; border-radius: 0; }
.map-page button:focus-visible, .map-page input:focus-visible, .map-page select:focus-visible, .map-page summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.map-page input, .map-page select { font-size: 14px; }
.floating-surface, .search-field, .cycle-control select { border-radius: 0; box-shadow: var(--workspace-shadow); }
.workspace-brand { position: absolute; top: 12px; left: 16px; pointer-events: none; display: grid; gap: 3px; }
.workspace-brand strong { font: 700 23px/1.1 var(--font-display); letter-spacing: .14em; }
.workspace-brand span { color: var(--map-muted); font: 9px/1.5 var(--font-mono); letter-spacing: .08em; }
.search-control { left: 216px; top: 12px; width: min(360px, calc(100% - 400px)); }
#search { height: 36px; font: 11px var(--font-mono); }
.search-field > span { color: var(--map-muted); }
.cycle-control { right: 16px; top: 12px; }
.cycle-control select { height: 38px; width: 136px; font: 10px var(--font-mono); padding: 0 10px; }
.tactical-toolbar { left: 12px; top: 80px; width: 112px; padding: 0; max-height: calc(100% - 190px); }
.tactical-toolbar button { flex-direction: row; justify-content: flex-start; gap: 7px; min-height: 38px; padding: 8px; border: 0; border-left: 2px solid transparent; font: 600 12px/1.2 var(--font-display); text-align: left; }
.tactical-toolbar button[aria-expanded="true"] { border: 0; border-left: 2px solid var(--ink); background: var(--map-hover); color: var(--ink); }
.tactical-toolbar svg { flex: 0 0 14px; width: 14px; height: 14px; }
.tool-window, .tool-window[data-tool="routing"], .tool-window[data-tool="activity"], .tool-window[data-tool="structures"], .tool-window[data-tool="discoveries"] { left: auto; right: 12px; top: 80px; bottom: 76px; width: min(360px, calc(100% - 152px)); max-width: none; max-height: none; }
.tool-window[data-tool="routing"], .tool-window[data-tool="activity"] { width: min(500px, calc(100% - 152px)); }
.information-heading { min-height: 44px; padding: 6px 10px 6px 14px; gap: 8px; border-bottom: 1px solid var(--map-line); }
.information-heading h2 { margin-right: auto; font: 500 11px/1.4 var(--font-mono); color: var(--bone); letter-spacing: .06em; }
.information-heading button { min-height: 36px; }
#minimize-tool, #minimize-information { font: 9px var(--font-mono); color: var(--map-muted); padding: 6px; }
.tool-content, #inspection, .celestial-inspection { padding: 12px 14px 16px; scrollbar-width: thin; scrollbar-color: var(--map-line) transparent; }
.tool-content { min-height: 0; }
.tool-note, .panel-note { font: 500 13px/1.5 var(--font-display); color: var(--map-muted); }
.tool-field { font: 10px/1.5 var(--font-mono); gap: 5px; margin-bottom: 12px; }
.tool-field input, .tool-field select, .tool-field textarea { border-radius: 0; min-height: 36px; background: var(--void); padding: 8px 9px; color: var(--bone); font: 11px var(--font-mono); }
.tool-field input[type="file"] { height: auto; white-space: normal; padding: 12px; font-size: 12px; }
.tool-field input::file-selector-button { border: 0; border-radius: 0; padding: 8px; margin-right: 8px; background: var(--map-hover); color: var(--bone); }
.tool-actions { gap: 6px; margin: 12px 0; }
.tool-actions button:first-child { border-color: var(--map-line); font-size: 12px; }
.tool-group-heading { margin: 20px 0 10px !important; font-size: 12px; }
.overlay-toggle { min-height: 38px; gap: 10px; font-size: 15px; }
.overlay-toggle input { width: 17px; height: 17px; }
.overlay-toggle small { font-size: 11px; margin-top: 3px; }
.information-overlay { right: 12px; top: 80px; bottom: 76px; width: 360px; max-width: calc(100% - 48px); max-height: none; }
.system-title { font: 700 28px/1.1 var(--font-display); margin-bottom: 12px !important; }
.system-stamp { line-height: 1.65; font-size: 13px; }
.system-details { grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; font-size: 13px; }
#inspection h3 { margin: 24px 0 12px; font-size: 14px; }
.technical-details { padding-top: 12px; border-top: 1px solid var(--map-line); }
.technical-details summary, .contribution-details > summary { font: 11px/1.5 var(--font-mono); padding: 12px 0; cursor: pointer; color: var(--map-muted); }
.known-links button { padding: 10px 0; gap: 14px; font-size: 14px; }
.selected-system { left: 24px; bottom: 74px; max-width: calc(100% - 48px); padding: 10px 16px; }
#selected-name { color: var(--bone); font-weight: 600; }
.map-signature { left: 24px; bottom: 24px; max-width: calc(100% - 440px); }
.map-signature > span { display: none; }
.map-signature small { font: 10px/1.5 var(--font-mono); }
.camera-controls { position: absolute; bottom: 16px; right: 12px; display: flex; align-items: center; padding: 0; gap: 0; }
.camera-controls button { font: 9px var(--font-mono); padding: 8px 10px; border-right: 1px solid var(--map-line); }
#zoom-in, #zoom-out { font: 500 19px var(--font-display); min-width: 34px; text-align: center; }
.camera-help summary { list-style: none; cursor: pointer; padding: 8px 12px; color: var(--map-muted); }
.camera-help p { position: absolute; right: 0; bottom: 64px; width: 320px; padding: 16px; border-radius: 0; background: var(--map-surface); color: var(--map-muted); box-shadow: var(--workspace-shadow); font-size: 12px; }
.fit-control { right: 24px; bottom: 80px; font: 9px var(--font-mono) !important; min-height: 32px !important; padding: 6px 10px !important; color: var(--map-muted) !important; }
.tool-minimized, .tool-window.tool-minimized[data-tool] { bottom: auto; }
.tool-minimized .tool-content, .information-minimized #inspection { display: none; }
.information-minimized { bottom: auto; }
.discovery-browser { margin-top: 12px; }
.discovery-list { list-style: none; padding: 0; margin: 12px 0 24px; max-height: 340px; overflow: auto; scrollbar-width: thin; }
.discovery-list button { display: grid; grid-template-columns: minmax(0,1fr) auto; width: 100%; gap: 1px 8px; padding: 8px 2px; border-bottom: 1px solid var(--map-line); border-radius: 0; }
.discovery-list strong { font: 600 17px/1.25 var(--font-display); overflow-wrap: anywhere; }
.discovery-list span { font: 9px/1.8 var(--font-mono); }
.discovery-list small { color: var(--map-muted); font-size: 12px; }
.import-workflow { border-top: 1px solid var(--map-line); border-bottom: 1px solid var(--map-line); margin: 12px 0; padding: 10px 0; }
.import-workflow > summary { cursor: pointer; color: var(--ink); font: 11px/1.5 var(--font-mono); padding: 4px 0; }
.import-steps { color: var(--map-muted); font: 9px/1.8 var(--font-mono); padding: 16px 0; }
#discovery-knowledge-counts { font-size: 15px; color: var(--bone); line-height: 1.8; }
.knowledge-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; font: 9px/1.5 var(--font-mono); }
.routing-tabs { gap: 4px; }
.routing-tabs button { font: 10px/1.4 var(--font-mono); padding: 10px 8px; }
.activity-cards { gap: 10px; }
.activity-section { margin-top: 24px; }
.solar-controls { left: 136px; top: 80px; max-height: calc(100% - 210px); overflow: auto; }
.gate-inspection { left: 136px; bottom: 120px; max-width: min(360px, calc(100% - 240px)); }
@container topology (max-width: 900px) {
  .workspace-brand { top: 20px; left: 16px; }
  .workspace-brand strong { font-size: 16px; }
  .workspace-brand span { display: none; }
  .search-control { top: 62px; left: 16px; width: calc(100% - 32px); }
  .cycle-control { top: 12px; right: 16px; }
  .cycle-control select { width: 140px; height: 38px; }
  .tactical-toolbar { top: 122px; left: 16px; width: calc(100% - 32px); display: flex; overflow-x: auto; padding: 4px; max-height: none; }
  .tactical-toolbar button { flex: 1 0 auto; width: auto; min-height: 44px; padding: 8px 12px; gap: 8px; font-size: 10px; }
  .tactical-toolbar svg { width: 16px; height: 16px; flex-basis: 16px; }
  .tool-window, .tool-window[data-tool], .information-overlay { top: 188px; right: 16px; bottom: 110px; left: auto; width: min(520px, calc(100% - 32px)); max-width: none; max-height: none; }
  .tool-window.tool-minimized[data-tool], .information-minimized { bottom: auto; }
  .map-signature { left: 16px; bottom: 16px; max-width: calc(100% - 32px); }
  .camera-controls { right: 16px; bottom: 56px; }
  .fit-control { right: 16px; bottom: 116px; }
  .selected-system { left: 16px; bottom: 116px; max-width: calc(100% - 180px); gap: 12px; }
  .solar-controls { left: 16px; top: 188px; width: min(330px, calc(100% - 32px)); max-height: calc(100% - 300px); }
  .gate-inspection { left: 16px; bottom: 180px; max-width: calc(100% - 32px); }
}
@container topology (max-width: 500px) {
  .tactical-toolbar { gap: 0; }
  .tactical-toolbar button { flex-direction: column; gap: 4px; font-size: 8px; padding: 8px; min-width: 62px; }
  .tool-window, .tool-window[data-tool], .information-overlay { top: 198px; bottom: 108px; }
  .tool-content, #inspection { padding: 16px; }
  .information-heading { padding: 8px 10px 8px 16px; }
  .tool-field input, .tool-field select, .tool-field textarea { font-size: 16px; }
  .system-title { font-size: 24px; }
  .routing-endpoints, .routing-grid, .activity-filters, .activity-charts { grid-template-columns: minmax(0,1fr); }
  .routing-tabs { flex-wrap: wrap; }
  .routing-tabs button { flex: 1 1 40%; }
  .selected-system { bottom: 116px; font-size: 12px; padding: 8px 10px; }
  .selected-system .action-label { display: none; }
  .map-signature small { font-size: 8px; }
  .discovery-list button { grid-template-columns: minmax(0,1fr); }
  .discovery-list small { grid-column: 1; }
}
@container topology (min-width: 901px) {
  .map-page:has(.tool-window:not([hidden]):not(.tool-minimized)) #map-stage { width: 100%; }
  .map-page:has(.tool-window[data-tool="routing"]:not([hidden]):not(.tool-minimized)) #map-stage,
  .map-page:has(.tool-window[data-tool="activity"]:not([hidden]):not(.tool-minimized)) #map-stage { width: 100%; }
  .map-page:has(.information-overlay:not([hidden]):not(.information-minimized)) #map-stage { width: calc(100% - 384px); }
}
@container topology (max-width: 500px) {
  .tool-window, .tool-window[data-tool], .information-overlay { top: auto; bottom: 108px; max-height: min(55%, 560px); }
  .tool-window.tool-minimized[data-tool], .information-minimized { top: 198px; bottom: auto; }
}
.evidence-details { margin-top: 14px; }
.evidence-details summary { padding: 8px 0; cursor: pointer; color: var(--map-muted); font-size: 12px; }
.evidence-details select { min-height: 44px; width: 100%; background: var(--void); border: 1px solid var(--map-line); padding: 8px; }
.camera-controls .context-fit { color: var(--map-muted); font-size: 9px; }
#tool-discoveries:has(#discovery-import[open]) .discovery-browser,
#tool-discoveries:has(#discovery-import[open]) .contribution-details { display: none; }
@container topology (max-width: 500px) {
  .camera-controls { left: 16px; right: 16px; justify-content: space-between; }
  .camera-controls button { font-size: 9px; padding: 8px; }
  #zoom-in, #zoom-out { min-width: 32px; }
  .map-page:has(.tool-window:not([hidden])) .selected-system { display: none; }
}
#tool-discoveries:has(#discovery-import[open]) > .tool-actions,
#tool-discoveries:has(#discovery-import[open]) > .knowledge-legend,
#tool-discoveries:has(#discovery-import[open]) > #discovery-knowledge-counts { display: none; }
.import-evidence { margin: 18px 0; }
.import-evidence summary { cursor: pointer; padding: 10px 0; font: 10px var(--font-mono); color: var(--map-muted); }
#discovery-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; }
@container topology (max-width: 500px) {
  .tactical-toolbar button { font-size: 9px; }
}
.import-evidence:has(#discovery-preview:empty) { display: none; }
@container topology (max-width: 500px) {
  .tool-window, .tool-window[data-tool], .information-overlay { max-height: min(55%, calc(100% - 310px), 560px); }
}
#tool-discoveries > .tool-actions { margin: 0 0 12px; }
#discovery-knowledge-counts { font-size: 13px; line-height: 1.5; margin-top: 6px; }
@container topology (max-width: 500px) {
  #tool-discoveries > .knowledge-legend { display: none; }
  .import-workflow { margin: 14px 0; padding: 12px 0; }
}

.map-page::before { content: ''; position: absolute; inset: 0 0 auto; height: 64px; background: var(--void); border-bottom: 1px solid var(--map-line); z-index: 1; pointer-events: none; }
.workspace-brand, .cycle-control { z-index: 2; }
.map-page button { min-height: 36px; }
.information-heading, .tactical-toolbar, .camera-controls { background: var(--void); }
.tool-window[data-tool="discoveries"] { width: min(344px, calc(100% - 152px)); }
.tool-actions button, #search, .tool-field { font-family: var(--font-mono); }
.tool-actions button:first-child { color: var(--bone); border-color: var(--map-line); }
.tool-actions button:first-child:hover:not(:disabled) { color: var(--ink); border-color: var(--ink); }
#discovery-knowledge-counts { font: 500 14px/1.4 var(--font-display); font-variant-numeric: tabular-nums; }
.import-workflow > summary { color: var(--bone); font-size: 9px; }
.import-workflow[open] > summary { color: var(--ink); }
.discovery-list small { font: 500 12px/1.4 var(--font-display); }
@container topology (max-width: 900px) {
 .map-page::before { height: 90px; }
 .workspace-brand { top: 12px; left: 12px; }
 .workspace-brand strong { font-size: 21px; }
 .cycle-control { top: 8px; right: 12px; }
 .cycle-control select { width: 128px; height: 30px; }
 .search-control { top: 46px; left: 12px; width: calc(100% - 24px); }
 #search { height: 34px; }
 .tactical-toolbar { left: 12px; top: 100px; width: calc(100% - 24px); display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); padding: 0; overflow: visible; }
 .tactical-toolbar button { min-width: 0; min-height: 40px; justify-content: center; padding: 7px 4px; gap: 5px; font: 600 12px/1.2 var(--font-display); border-left: 0; border-bottom: 2px solid transparent; }
 .tactical-toolbar button[aria-expanded="true"] { border-left: 0; border-bottom-color: var(--ink); }
 .tool-window, .tool-window[data-tool], .information-overlay { top: 154px; right: 12px; bottom: 76px; width: min(440px, calc(100% - 24px)); }
 .solar-controls { top: 154px; }
 .camera-controls { right: 12px; bottom: 50px; }
}
@container topology (max-width: 600px) {
 .tactical-toolbar { top: 90px; grid-template-columns: repeat(3,minmax(0,1fr)); }
 .tactical-toolbar button { flex-direction: row; justify-content: flex-start; min-height: 34px; padding: 7px; font-size: 12px; }
 .tactical-toolbar svg { flex-basis: 12px; width: 12px; height: 12px; }
 .tool-window, .tool-window[data-tool], .information-overlay { top: auto; bottom: 88px; max-height: min(58%,calc(100% - 260px),560px); }
 .tool-window.tool-minimized[data-tool], .information-minimized { top: 172px; bottom: auto; }
 .tool-content, #inspection { padding: 12px; }
 .tool-field input, .tool-field select, .tool-field textarea { min-height: 40px; font-size: 16px; }
 .tool-field input[type="file"] { font-size: 11px; }
 .camera-controls { left: 12px; right: 12px; bottom: 40px; justify-content: space-between; }
 .camera-controls button { min-height: 36px; padding: 8px; font-size: 8px; }
 .map-signature small { font-size: 7px; }
 .map-page:has(.tool-window:not([hidden])) .selected-system { display: none; }
 #tool-discoveries > .knowledge-legend { display: none; }
 .discovery-list button { grid-template-columns: minmax(0,1fr) auto; }
 .discovery-list strong { font-size: 18px; }
}
@container topology (min-width: 901px) {
 .map-page:has(.tool-window:not([hidden]):not(.tool-minimized)) #map-stage { width: 100%; }
 .tool-window[data-floating] { right: auto; bottom: auto; max-width: none; max-height: none; }
 .tool-window[data-floating].tool-minimized { min-height: 0; }
 .tool-window[data-floating] > .information-heading { cursor: move; touch-action: none; flex: 0 0 auto; }
 .tool-window[data-floating] .tool-content { flex: 1; overflow: auto; }
 .window-title { cursor: move; }
}
.window-title, .window-title:disabled { min-height: 24px; border: 0; background: none; color: var(--bone); padding: 0; font: inherit; letter-spacing: inherit; text-align: left; opacity: 1; }
.tool-window[data-floating] > .information-heading h2 { min-width: 0; margin-right: auto; }
.tool-window[data-floating] > .information-heading button:not(.window-title) { flex-shrink: 0; }
.tool-window[data-floating] .window-resize { position: absolute; right: 0; bottom: 0; width: 20px; min-height: 20px; padding: 0; border: 0; background: linear-gradient(135deg,transparent 65%,var(--map-line) 66%,var(--map-line) 74%,transparent 75%); cursor: nwse-resize; touch-action: none; }
.tool-window[data-floating] .window-resize:focus-visible, .window-title:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.context-menu, .search-control { z-index: 30; }
.tactical-toolbar, .camera-controls { z-index: 20; }

.information-overlay { z-index: 15; }
.gate-inspection { left: auto; right: 18px; bottom: auto; height: auto; z-index: 16; max-height: calc(100% - 170px); }
@container topology (max-width: 900px) {
  .gate-inspection { top: 154px; right: 16px; width: min(360px, calc(100% - 32px)); max-height: calc(100% - 260px); }
}
.tool-window[data-floating] .information-heading button[aria-expanded] { font: 9px var(--font-mono); color: var(--map-muted); padding: 6px; }
#toggle-ui { position: absolute; left: 14px; bottom: 48px; z-index: 35; min-height: 44px; padding: 8px 12px; font: 11px var(--font-mono); color: var(--bone); }
.map-page.ui-hidden > :not(#map-stage):not(canvas):not(#public-map-markers):not(#toggle-ui):not(#render-error) { display: none !important; }
.system-route-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.system-route-actions button { flex: 1 0 110px; border: 1px solid var(--map-line); padding: 8px; font: 11px var(--font-mono); }
#inspection > details { margin-top: 16px; }
#inspection > details > summary, #route-structures summary { cursor: pointer; padding: 10px 0; color: var(--map-muted); font-size: 12px; }
.information-overlay { width: min(380px,calc(100% - 156px)); max-height: calc(100% - 160px); }
.route-comparison, .route-avoided { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.route-comparison:empty, .route-avoided:empty { display: none; }
.route-comparison button, .route-avoided button { padding: 8px; border: 1px solid var(--map-line); font: 11px var(--font-mono); }
.route-comparison [aria-pressed="true"], #route-results [aria-current="step"] { border-color: var(--ink); color: var(--ink); background: var(--map-hover); }
.route-progress { font: 11px/1.6 var(--font-mono); color: var(--bone); padding: 8px 0; }
.route-progress:empty { display: none; }
#route-results button { text-align: left; }
.tool-window .window-pin { font: 10px var(--font-mono); padding: 6px; }
.tool-window:not(.tool-pinned) .information-heading { cursor: default; }
@container topology (max-width: 900px) {
 .workspace-brand { top: 10px; left: 12px; }
 .workspace-brand strong { font-size: 18px; }
 .workspace-brand span { display: none; }
 .search-control { top: 46px; left: 12px; width: calc(100% - 24px); }
 .cycle-control { top: 8px; right: 12px; }
 .tactical-toolbar { top: 94px; left: 8px; right: 8px; width: auto; display: flex; overflow-x: auto; max-height: 54px; }
 .tactical-toolbar button { flex: 1 0 54px; min-height: 46px; justify-content: center; padding: 6px; font-size: 11px; text-align: center; border-left: 0; border-bottom: 2px solid transparent; }
 .tactical-toolbar button[aria-expanded="true"] { border-left: 0; border-bottom: 2px solid var(--ink); }
 .tactical-toolbar svg { display: none; }
 .tool-window[data-floating], .tool-window[data-tool], .information-overlay { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-width: none; height: min(55%,520px); max-height: calc(100% - 156px); }
 .information-overlay { display: flex; flex-direction: column; }
 .information-overlay #inspection { overflow-y: auto; }
 .tool-window[data-floating].tool-minimized, .information-overlay.information-minimized { height: auto; }
 .tool-content { min-height: 0; overflow: auto; }
 #toggle-ui { bottom: 70px; left: 8px; }
 .camera-controls { bottom: 28px; }
 .map-signature { bottom: 4px; max-width: calc(100% - 20px); }
 .system-route-actions button { min-height: 44px; }
}
@container topology (max-width: 900px) {
 .map-page:has(.tool-window:not([hidden]):not(.tool-minimized)) .camera-controls,
 .map-page:has(.information-overlay:not([hidden]):not(.information-minimized)) .camera-controls { display: none; }
 .map-page:has(.tool-window:not([hidden])) #toggle-ui,
 .map-page:has(.information-overlay:not([hidden])) #toggle-ui { top: 150px; bottom: auto; }
 .map-signature small { font-size: 9px; line-height: 1.4; }
}

.map-page .tactical-toolbar button {
  color: var(--bone);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.map-page .tactical-toolbar button[aria-expanded="true"] {
  background: color-mix(in srgb, var(--ink) 14%, var(--void));
}
.map-page .tactical-toolbar button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.map-page #window-overlays { border-color: var(--map-line); }
.map-page #tool-overlays .overlay-section + .overlay-section { border-top: 0; }
.map-page #tool-overlays .overlay-section[open] + .overlay-section { border-top: 1px solid var(--map-line); }
.map-page #tool-overlays .overlay-section > summary { font-size: 13px; letter-spacing: .015em; }
.map-page #tool-overlays .overlay-toggle { padding-left: 12px; }
@container topology (max-width: 900px) {
  .map-page .tactical-toolbar {
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .map-page .tactical-toolbar button {
    flex: 1 0 auto;
    min-height: 44px;
    min-width: 4.5rem;
    padding-inline: .65rem;
    white-space: nowrap;
    font-size: 14px;
  }
  .map-page #tool-overlays .overlay-section > summary { min-height: 44px; }
}
