:root {
  color-scheme: dark;
  background: #080808;
  color: #eeeeeb;
  --ui-font: system-ui, sans-serif;
  --header-height: 72px;
  font: 14px/1.45 var(--ui-font);
  --muted: #a4a4a0;
  --line: #383838;
  --line-soft: #252525;
  --surface: #101010;
  --inset: #0a0a0a;
  --accent: #f4f4ef;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:where(button, select, input, a, canvas, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.top {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 3px 0 #050505;
}
.brand {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font: 560 23px/1 var(--ui-font);
  letter-spacing: -.055em;
}
.brand-mark {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent);
  background: conic-gradient(currentColor 0 25%, transparent 0 50%, currentColor 0 75%, transparent 0);
}

.account { display: flex; align-items: center; gap: 20px; white-space: nowrap; font-size: 12px; }
.console-status { color: var(--muted); }
.console-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  vertical-align: 1px;
  background: var(--accent);
}
.logout, .primary {
  border: 1px solid var(--line);
  background: #151515;
  color: inherit;
  padding: 7px 12px;
  font: 12px/1.3 var(--ui-font);
  box-shadow: 2px 2px 0 #030303;
}
.logout:hover { border-color: var(--accent); color: var(--accent); }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(258px, 24%);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100dvh - var(--header-height));
  min-height: 320px;
}
.map, .inspector { border: 1px solid var(--line); min-width: 0; box-shadow: 3px 3px 0 #030303; }
.map {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #000;
}
.map-bar, .inspector h2 {
  height: 47px;
  border-bottom: 1px solid var(--line);
  background-color: var(--surface);
}
.map-bar {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  padding: 0 12px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.map-bar h1, .inspector h2 { font: 540 14px/1 var(--ui-font); margin: 0; }
.map-bar h1::before, .inspector h2::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  background: var(--accent);
}
.map-controls { display: flex; align-items: center; gap: 5px; pointer-events: auto; }
.map-controls button, .refresh {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 1px solid var(--line);
  background: #141414;
  box-shadow: 1px 1px #050505;
  color: #eeeeeb;
}
.map-controls button:hover, .refresh:hover, #pan-view[aria-pressed="true"] { background: #252525; color: var(--accent); border-color: #91918c; }
#reset-view { margin-left: 5px; }
.map-controls svg, .refresh svg, .search svg { width: 16px; height: 16px; fill: currentColor; shape-rendering: crispEdges; }
#space { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline-offset: -4px; }
#space.pan-mode { cursor: move; }
#space.over-globe:not(.dragging):not(.pan-mode) { cursor: pointer; }
#space.dragging { cursor: grabbing; }
.map-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orb-label, .core-label {
  position: absolute;
  z-index: 2;
  translate: -50% -50%;
  white-space: nowrap;
  appearance: none;
  border: 0;
  color: #eeeee9;
  background: transparent;
  font: 560 clamp(12px, 1.12vw, 16px)/1.1 var(--ui-font);
  letter-spacing: -.055em;
  padding: 5px 7px;
  pointer-events: auto;
  text-shadow: 0 1px 4px #000, 0 0 10px #000;
}
.core-label { font-size: clamp(17px, 1.7vw, 25px); padding: 4px 9px; }
.orb-label:hover, .orb-label[aria-pressed="true"], .core-label:hover, .core-label[aria-pressed="true"] {
  color: var(--accent);
}
.orb-label[data-offline="true"] { color: var(--muted); }
.tool-node {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--node-size, 18px);
  height: var(--node-size, 18px);
  translate: -50% -50%;
  pointer-events: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: #e0e0de;
}
.skill-node::before {
  content: '';
  width: 6px;
  height: 6px;
  border: 1px solid #afafaa;
  background: #424242;
}
.tool-node:hover, .tool-node:focus-visible, .tool-node[aria-pressed="true"] { z-index: 3; }
.skill-node:hover::before, .skill-node:focus-visible::before, .skill-node[aria-pressed="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #d9d9d933;
}
.tool-node-name {
  display: none;
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  translate: -50% 0;
  width: max-content;
  max-width: min(232px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 6px;
  border: 1px solid #676767;
  background: #101010;
  box-shadow: 2px 2px #020202;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.tool-node[data-label-edge="left"] .tool-node-name { left: 0; translate: 0 0; }
.tool-node[data-label-edge="right"] .tool-node-name { left: auto; right: 0; translate: 0 0; }
.tool-node:hover .tool-node-name, .tool-node:focus-visible .tool-node-name,
.tool-node[aria-pressed="true"] .tool-node-name,
.tool-node[data-show-name="true"] .tool-node-name { display: block; }
.map-hint {
  position: absolute;
  pointer-events: none;
  left: 13px;
  bottom: 12px;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  background: #0a0a0aee;
  color: #a9a9a5;
  font-size: 11px;
}
.touch-hint { display: none; }
.inspector {
  background: var(--surface);
  padding: 0 13px 13px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.inspector h2 {
  flex: none;
  display: flex;
  align-items: center;
  margin: 0 -13px 13px;
  padding: 0 15px;
  background: var(--surface);
}
.inspector-top { display: flex; gap: 6px; align-items: center; }
.inspector-top select {
  flex: 1;
  min-width: 0;
  min-height: 35px;
  border: 1px solid var(--line);
  padding: 4px 5px;
  background: var(--inset);
  color: inherit;
  font: 13px/1.3 var(--ui-font);
}
.refresh { width: 35px; height: 35px; flex: none; }
.service-status { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; font-size: 12px; color: #deded9; margin: 11px 0 16px; }
.service-status::before { content: ''; width: 6px; height: 6px; background: #7d7d7d; }
.service-status[data-connected="true"]::before { background: var(--accent); }
.mode { color: var(--muted); width: 100%; margin-left: 14px; font-size: 11px; }
.search { position: relative; }
.search svg { position: absolute; left: 9px; top: 10px; width: 14px; height: 14px; pointer-events: none; color: var(--muted); }
input { width: 100%; color: inherit; border: 1px solid var(--line); border-radius: 0; padding: 9px 11px; background: var(--inset); }
.search input { padding: 8px 9px 8px 30px; font-size: 12px; }
input::placeholder { color: var(--muted); }
.tools { list-style: none; margin: 13px -3px 0 0; padding: 0 3px 0 0; overflow-y: auto; min-height: 0; scrollbar-color: #565656 var(--inset); }
.tools li { margin: 0 0 5px; border: 1px solid var(--line-soft); background: var(--inset); }
.tools li:hover, .tools li:has(details[open]) { border-color: #777; }
.tools summary { padding: 9px; display: flex; gap: 8px; align-items: center; justify-content: space-between; list-style: none; }
.tools summary::-webkit-details-marker { display: none; }
.tools summary::after { content: '+'; flex: none; color: var(--accent); font: 12px/1 var(--ui-font); }
.tools details[open] summary::after { content: '-'; }
.tools code { font: 12px var(--ui-font); overflow-wrap: anywhere; }
.tools details p { color: #bdbdb8; font-size: 12px; line-height: 1.5; margin: 0; padding: 0 9px 9px; }
.empty, .notice { color: var(--muted); font-size: 13px; line-height: 1.5; }
.notice { margin: 44px auto; text-align: center; }
.error { color: #ffbabc; margin: 10px 0; font-size: 13px; }
.signin { width: min(460px, calc(100% - 40px)); margin: 12vh auto 35px; padding: 26px; border: 1px solid var(--line); box-shadow: 5px 5px 0 #030303; background: var(--surface); }
.signin h1 { margin: 0; font: 560 29px/1.15 var(--ui-font); color: var(--accent); }
.signin p, .signin label { color: var(--muted); }
.signin .error { color: #ffbabc; }
.signin form { display: grid; gap: 10px; margin-top: 24px; }
.primary { justify-self: start; background: var(--accent); color: #111; border-color: var(--accent); }
.primary:hover { background: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (pointer: coarse) {
  .map-hint span:first-child { display: none; }
  .map-hint .touch-hint { display: inline; }
}
@media (min-width: 761px) {
  .map, .inspector { box-shadow: none; }
  .inspector { border-inline-start: 0; }
}
@media (max-width: 760px) {
  .top { height: 58px; padding: 0 13px; }
  .brand { font-size: clamp(13px, 3.6vw, 18px); gap: 8px; }
  .brand-mark { width: 19px; height: 19px; }
  .account { gap: 0; font-size: 10px; }
  .account span:has(+ button:not([hidden])) { display: none; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: 0;
    gap: 11px;
    margin: 13px 10px 22px;
  }
  .map { height: clamp(345px, 58dvh, 520px); }
  .map-bar { padding-inline: 8px; height: 42px; }
  .map-bar h1, .inspector h2 { font-size: 12px; }
  .map-controls { gap: 4px; }
  .map-controls button { width: 27px; height: 27px; }
  .orb-label { padding: 3px 4px; }
  .map-hint { left: 7px; bottom: 7px; padding: 3px 5px; font-size: 9px; }
  .inspector { max-height: 485px; }
}

.catalog-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 11px;
}
.catalog-switch button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--inset);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.catalog-switch button:hover, .catalog-switch button[aria-pressed="true"] {
  border-color: #aaa;
  background: #242424;
  color: var(--accent);
}
.skill-node::before { transform: rotate(45deg); }
.skill-instructions {
  margin: 0 9px 9px;
  padding: 9px;
  border-top: 1px solid var(--line-soft);
  color: #e3e3df;
  font: 12px/1.5 var(--ui-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

body.map-expanded { overflow: hidden; }
body.map-expanded .top, body.map-expanded .inspector { display: none; }
body.map-expanded .layout {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: block;
  height: auto;
  min-height: 0;
  margin: 0;
}
body.map-expanded .map, .map:fullscreen {
  width: 100%;
  height: 100%;
  border: 0;
  box-shadow: none;
}
