.json-container {
  min-height: 260px;
  font: 0.78rem/1.6 "Menlo", "Consolas", "Ubuntu Mono", monospace;
  color: #1f2933;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.35rem 1.25rem;
}


.json-text {
  margin: 0;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2933;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  min-height: 100%;
}

.json-tree-text {
  white-space: normal;
}

.json-match-node {
  display: block;
  border-radius: 5px;
  margin-left: -0.25rem;
  padding-left: 0.25rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.json-match-node.class-highlight-hover {
  background: var(--semantic-highlight-bg);
  box-shadow: 0 0 0 2px var(--semantic-highlight-border);
}

.json-match-node.class-highlight-pinned {
  background: var(--semantic-pinned-bg);
  box-shadow: 0 0 0 2px var(--semantic-pinned-border);
}

.json-empty {
  color: #6b7280;
  font-style: italic;
}

.match-tree {
  min-height: 100%;
  padding: 1rem 1.1rem;
  overflow: auto;
  color: #334155;
  font: 0.82rem/1.68 "Menlo", "Consolas", "Ubuntu Mono", monospace;
}

.match-tree-node {
  margin: 0.08rem 0;
}

.match-tree > .match-tree-node + .match-tree-node {
  margin-top: 1.4rem;
}

.match-tree-summary {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  width: max-content;
  min-width: 100%;
  min-height: 1.65rem;
  cursor: pointer;
  outline: none;
  border-radius: 5px;
  padding: 0 0.25rem;
  margin-left: -0.25rem;
  transition: background 0.12s ease;
}

.match-tree-summary::marker {
  content: "";
}

.match-tree-summary:focus-visible {
  background: var(--semantic-node-hover-surface);
}

.match-tree-toggle {
  flex: 0 0 0.72rem;
  width: 0.72rem;
  height: 0.72rem;
  align-self: center;
  position: relative;
  color: #64748b;
}

.match-tree-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.3rem;
  height: 0.3rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-55%, -65%) rotate(45deg);
  transition: transform 0.14s ease;
}

.match-tree-node:not(.match-tree-has-children) > .match-tree-summary {
  cursor: default;
}

.match-tree-node:not(.match-tree-has-children) > .match-tree-summary .match-tree-toggle::before {
  display: none;
}

.match-tree-node:not([open]) > .match-tree-summary .match-tree-toggle::before {
  transform: translate(-65%, -50%) rotate(-45deg);
}

.match-tree-main {
  min-width: max-content;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  overflow: hidden;
}

.match-tree-main-type-only {
  flex: 0 1 auto;
}

.match-tree-main-root {
  flex: 1 1 auto;
}

.match-tree-value-separator {
  color: #64748b;
  flex: 0 0 auto;
}

.match-tree-index {
  color: #64748b;
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 600;
}

.match-tree-placeholder {
  color: #64748b;
  font-style: italic;
}

.match-tree-type-meta {
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  margin-left: 1.25rem;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.03rem 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.32);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.07);
  color: #2563eb;
  overflow: visible;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.18), 0 3px 6px rgba(15, 23, 42, 0.09);
}

.match-tree .node-field {
  display: inline-flex;
  align-items: center;
  box-sizing: content-box;
  color: #92400e;
  font-size: 0.76rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.match-tree .node-type {
  color: inherit;
  font-weight: 500;
}

.match-tree-type-meta .node-type {
  font-size: 0.63rem;
}

.match-tree-type-meta--root {
  margin-left: 0;
  margin-right: 0.34rem;
  padding-inline: 0.78rem;
}

.match-tree-type-meta--root .node-type {
  font-size: 0.68rem;
}

.match-tree-type-node {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.match-tree-type-meta--expandable {
  gap: 0.22rem;
  padding-left: 0.38rem;
}

.match-tree-type-meta--inline {
  margin-left: 0;
  margin-right: 0.18rem;
}

.match-tree-type-meta .match-tree-type-parent {
  opacity: 0.78;
}

:root[data-theme="dark"] .match-tree-type-meta {
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08),
    0 1px 1px rgba(0, 0, 0, 0.68),
    0 3px 6px rgba(0, 0, 0, 0.42);
}

.match-tree-text {
  min-width: 0;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-tree-text-preview {
  color: #475569;
  opacity: 0.82;
}

.match-tree-text-leaf {
  color: #1f2937;
}

.match-tree-children {
  margin-left: 0.4rem;
  padding-left: 0.85rem;
}

.match-tree-type-owns-children > .match-tree-children {
  position: relative;
  margin-left: var(--match-tree-child-offset, 0.4rem);
}

.match-tree-type-owns-children > .match-tree-children::before {
  content: "";
  position: absolute;
  top: -0.34rem;
  left: 0;
  height: 0.4rem;
  border-left: 1px solid rgba(148, 163, 184, 0.52);
  pointer-events: none;
}

/* Safari may retain a closed details body's layout space without this explicit rule. */
.match-tree-node:not([open]) > .match-tree-children {
  display: none;
}

.match-tree-children > .match-tree-node {
  position: relative;
}

.match-tree-children > .match-tree-node::before {
  content: "";
  position: absolute;
  top: -0.08rem;
  bottom: -0.08rem;
  left: -0.85rem;
  border-left: 1px solid rgba(148, 163, 184, 0.52);
  pointer-events: none;
}

.match-tree-children > .match-tree-node::after {
  content: "";
  position: absolute;
  top: 0.83rem;
  left: -0.85rem;
  width: 0.6rem;
  border-top: 1px solid rgba(148, 163, 184, 0.52);
  pointer-events: none;
}

.match-tree-children > .match-tree-node:last-child::before {
  bottom: auto;
  height: 0.91rem;
}

.json-warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #7c2d12;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

.json-plain {
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
}

.json-tree {
  list-style: none;
  margin: 0;
  padding-left: 1rem;
}

.json-node {
  margin: 0.15rem 0;
}

.json-branch {
  margin: 0.08rem 0;
}

.json-branch-summary {
  cursor: pointer;
  color: #1f2933;
  min-height: 1.3rem;
  outline: none;
}

.json-branch-summary::marker {
  color: #94a3b8;
}

.json-branch-summary:focus-visible {
  border-radius: 5px;
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

.json-branch-children {
  margin-left: 1.05rem;
  padding-left: 0.8rem;
  border-left: 1px solid rgba(148, 163, 184, 0.34);
}

.json-branch:not([open]) > .json-branch-children,
.json-branch:not([open]) > .json-branch-close {
  display: none;
}

.json-branch-close,
.json-line {
  min-height: 1.3rem;
}

.json-branch-close {
  color: #1f2933;
}

.json-bracket {
  color: #1f2933;
}

.json-collapsed-preview {
  display: none;
  color: #94a3b8;
}

.json-branch:not([open]) .json-collapsed-preview {
  display: inline;
}

.json-summary {
  position: relative;
  cursor: pointer;
  font-weight: 600;
  color: #1f2933;
}

.json-summary::marker {
  color: #94a3b8;
}

.json-summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  border-radius: 6px;
}

.json-key {
  color: #2563eb;
}

.json-root {
  color: #1f2933;
  font-weight: 600;
}

.json-count {
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.04em;
  opacity: 0.5;
}

.json-array-count {
  display: none;
}

.json-branch:not([open]) > .json-branch-summary .json-array-count {
  display: inline-flex;
  opacity: 0.8;
}

.json-children {
  margin-left: 1.1rem;
  padding-left: 0.8rem;
  border-left: 2px solid rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.json-entry {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}

.json-colon {
  color: #94a3b8;
  margin-right: 0.35rem;
}

.json-value-string {
  color: #0ea5e9;
}

.json-value-number {
  color: #22c55e;
}

.json-value-boolean {
  color: #f97316;
}

.json-value-null {
  color: #ef4444;
}

.json-token-key {
  color: #2563eb;
}

.json-token-string {
  color: #0891b2;
}

.json-token-number {
  color: #16a34a;
}

.json-token-boolean {
  color: #f97316;
}

.json-token-null {
  color: #ef4444;
}

.empty-state {
  color: #6b7280;
  font-style: italic;
}
