:root {
  --header-bg: #16324f;
  --link-color: #1769aa;
  --border-color: #d7dde3;
  --key-color: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1f2933;
  background: #f6f8fa;
}

.nav-header {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  color: #fff;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.nav-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 200px;
  font-size: 0.95rem;
  min-height: 32px;
  overflow-wrap: anywhere;
}

.nav-breadcrumb a {
  color: #cfe3f7;
  text-decoration: none;
}

.nav-breadcrumb a:hover {
  text-decoration: underline;
}

.nav-breadcrumb .sep {
  color: #7ea3c4;
}

.nav-address {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.nav-address input {
  width: 320px;
  max-width: 60vw;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

.nav-address button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: var(--link-color);
  color: #fff;
  cursor: pointer;
}

.view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
}

.view-toggle button {
  background: transparent;
  border: 1px solid #7ea3c4;
  color: #cfe3f7;
  cursor: pointer;
  font: inherit;
  padding: 6px 12px;
}

.view-toggle button:first-child {
  border-radius: 4px 0 0 4px;
}

.view-toggle button:last-child {
  border-left: 0;
  border-radius: 0 4px 4px 0;
}

.view-toggle button[aria-pressed="true"] {
  background: #fff;
  color: var(--header-bg);
}

.view-toggle button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

@media (max-width: 760px) {
  .nav-header {
    grid-template-columns: 1fr auto;
  }

  .nav-breadcrumb {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .nav-address {
    min-width: 0;
  }

  .nav-address input {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .nav-header {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .nav-address,
  .view-toggle,
  .resource-toggle {
    width: 100%;
  }

  .nav-address input {
    max-width: none;
  }

  .view-toggle button {
    flex: 1;
  }

}

#content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.nav-status {
  color: var(--key-color);
}

.nav-status.error {
  color: #b3261e;
}

.json-tree, .json-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 20px;
}

.json-tree {
  padding-left: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px 20px;
}

.json-tree li {
  padding: 2px 0;
}

.json-raw {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  margin: 0;
  overflow: auto;
  padding: 16px 20px;
  tab-size: 2;
  white-space: pre;
}

.json-key {
  color: var(--key-color);
}

.json-key[title] {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.json-toggle {
  cursor: pointer;
  user-select: none;
  color: var(--key-color);
  display: inline-block;
  width: 1em;
}

.json-value-string { color: #0b6a35; }
.json-value-number { color: #a45c00; }
.json-value-boolean, .json-value-null { color: #7c3aed; }

.json-link {
  color: var(--link-color);
  text-decoration: none;
  cursor: pointer;
}

.json-link:hover {
  text-decoration: underline;
}

.json-raw .json-link {
  white-space: pre;
}

.collapsed > ul {
  display: none;
}
