:root {
  color-scheme: dark;

  --background: #02040b;
  --panel: rgb(7 13 27 / 86%);
  --panel-solid: #08101f;
  --border: rgb(126 174 255 / 20%);
  --border-active: rgb(94 195 255 / 65%);
  --text: #edf6ff;
  --muted: #8194ad;
  --cyan: #55d9ff;
  --blue: #4d86ff;
  --purple: #b46cff;
  --green: #49f2bd;
  --orange: #ff9d55;
  --yellow: #ffd45c;
  --pink: #ff6fca;
  --red: #ff657e;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--background);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select {
  border: 1px solid var(--border);
  border-radius: 9px;
}

button {
  padding: 9px 12px;
  background:
    linear-gradient(
      135deg,
      rgb(35 72 124 / 66%),
      rgb(22 37 69 / 66%)
    );
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

button:hover {
  border-color: var(--border-active);
  background:
    linear-gradient(
      135deg,
      rgb(43 97 168 / 80%),
      rgb(34 53 94 / 80%)
    );
}

button:active {
  transform: translateY(1px);
}

input,
select {
  width: 100%;
  padding: 10px 11px;
  background: rgb(2 8 18 / 85%);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgb(76 176 255 / 10%);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--cyan);
}

#spaceBackground {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(
      circle at 22% 28%,
      rgb(54 87 189 / 24%),
      transparent 34%
    ),
    radial-gradient(
      circle at 76% 68%,
      rgb(134 59 190 / 17%),
      transparent 34%
    ),
    radial-gradient(
      circle at center,
      #071124 0%,
      #02040b 72%
    );
}

#spaceBackground::before,
#spaceBackground::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

#spaceBackground::before {
  opacity: 0.65;
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.3px),
    radial-gradient(circle, #8bcaff 0 1px, transparent 1.4px),
    radial-gradient(circle, #d3b6ff 0 1px, transparent 1.2px);
  background-position:
    0 0,
    37px 61px,
    83px 26px;
  background-size:
    137px 137px,
    191px 191px,
    251px 251px;
}

#spaceBackground::after {
  background:
    linear-gradient(
      to bottom,
      rgb(0 0 0 / 3%),
      rgb(0 0 0 / 36%)
    );
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  background: rgb(3 8 18 / 74%);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 37px;
  height: 37px;
  border: 1px solid rgb(90 215 255 / 60%);
  border-radius: 50%;
  box-shadow:
    0 0 12px rgb(62 196 255 / 42%),
    inset 0 0 14px rgb(91 144 255 / 33%);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.brand-mark::before {
  inset: 9px;
  background: #d8f6ff;
  box-shadow:
    0 0 10px #5dd8ff,
    0 0 24px #5b87ff;
}

.brand-mark::after {
  inset: 3px -4px;
  border: 1px solid rgb(151 121 255 / 66%);
  transform: rotate(-24deg);
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.03em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.graph-stats {
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  display: none;
}

main,
#graph3d {
  position: fixed;
  inset: 0;
}

#graph3d {
  z-index: 1;
}

#graph3d canvas {
  outline: none;
}

.panel {
  position: fixed;
  z-index: 10;
  top: 86px;
  bottom: 48px;
  width: 290px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow:
    0 16px 60px rgb(0 0 0 / 35%),
    inset 0 1px rgb(255 255 255 / 3%);
  backdrop-filter: blur(18px);
}

.control-panel {
  left: 16px;
}

.detail-panel {
  right: 16px;
  width: 320px;
}

.panel-section {
  margin-bottom: 18px;
}

.panel label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #9eb0c7;
  font-size: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.search-results {
  max-height: 190px;
  margin-top: 9px;
  overflow-y: auto;
}

.result-item {
  width: 100%;
  margin: 4px 0;
  padding: 8px 9px;
  text-align: left;
  background: rgb(5 14 30 / 82%);
}

.result-item strong,
.result-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-item strong {
  font-size: 12px;
}

.result-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 20px;
}

.button-grid button {
  min-height: 42px;
  font-size: 11px;
}

.legend h2 {
  margin: 0 0 10px;
  font-size: 13px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 11px;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.legend .controller {
  color: var(--orange);
  background: var(--orange);
}

.legend .model {
  color: var(--green);
  background: var(--green);
}

.legend .service {
  color: var(--blue);
  background: var(--blue);
}

.legend .route {
  color: var(--pink);
  background: var(--pink);
}

.legend .middleware {
  color: var(--yellow);
  background: var(--yellow);
}

.legend .method {
  color: var(--purple);
  background: var(--purple);
}

.legend .file {
  color: var(--cyan);
  background: var(--cyan);
}

.legend .other {
  color: #9ba9bc;
  background: #9ba9bc;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.detail-heading h2 {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.close-button {
  padding: 1px 8px 5px;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
}

.empty-detail {
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.detail-panel dl {
  margin: 19px 0 0;
}

.detail-panel dt {
  margin-top: 13px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.detail-panel dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 18px;
}

.detail-panel h3 {
  margin: 21px 0 8px;
  font-size: 12px;
}

.relation-item {
  margin: 6px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgb(3 10 23 / 75%);
  font-size: 10px;
}

.relation-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--cyan);
}

.relation-item button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 10px;
}

.help {
  position: fixed;
  z-index: 8;
  right: 350px;
  bottom: 14px;
  display: flex;
  gap: 13px;
  color: rgb(166 187 215 / 70%);
  font-size: 10px;
  pointer-events: none;
}

.tooltip {
  position: fixed;
  z-index: 30;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid var(--border-active);
  border-radius: 8px;
  background: rgb(2 7 16 / 92%);
  color: var(--text);
  box-shadow: 0 8px 30px rgb(0 0 0 / 45%);
  font-size: 11px;
  pointer-events: none;
}

.tooltip small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background:
    radial-gradient(
      circle,
      rgb(14 31 69 / 96%),
      rgb(1 3 9 / 99%) 65%
    );
  text-align: center;
  transition:
    opacity 500ms ease,
    visibility 500ms ease;
}

.loading-overlay.hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-overlay span {
  color: var(--muted);
  font-size: 12px;
}

.loader-orbit {
  position: relative;
  width: 72px;
  height: 72px;
  animation: rotate 3s linear infinite;
}

.loader-orbit div {
  position: absolute;
  border: 1px solid rgb(111 198 255 / 55%);
  border-radius: 50%;
}

.loader-orbit div:nth-child(1) {
  inset: 5px;
}

.loader-orbit div:nth-child(2) {
  inset: 15px -5px;
  transform: rotate(58deg);
}

.loader-orbit div:nth-child(3) {
  inset: 27px;
  border: 0;
  background: #d9f7ff;
  box-shadow:
    0 0 15px #55d9ff,
    0 0 35px #526eff;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1000px) {
  .detail-panel {
    display: none;
  }

  .help {
    right: 20px;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 62px;
  }

  .brand p,
  .graph-stats {
    display: none;
  }

  .icon-button {
    display: block;
  }

  .panel {
    top: 72px;
    bottom: 12px;
  }

  .control-panel {
    left: 10px;
    width: min(290px, calc(100vw - 20px));
    transform: translateX(calc(-100% - 20px));
    transition: transform 200ms ease;
  }

  .control-panel.open {
    transform: translateX(0);
  }

  .help {
    display: none;
  }
}
