:root {
  --bg-base: #dbeafe;
  --bg-surface: rgba(255, 255, 255, 0.62);
  --bg-surface-strong: rgba(255, 255, 255, 0.68);
  --bg-accent-1: rgba(125, 211, 252, 0.24);
  --bg-accent-2: rgba(134, 239, 172, 0.18);
  --text: #102034;
  --muted: #4a607b;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #15803d;
  --accent-strong: #166534;
  --font-sans: "Space Grotesk", sans-serif;
}

:root[data-theme="dark"] {
  --bg-base: #08111f;
  --bg-surface: rgba(255, 255, 255, 0.12);
  --bg-surface-strong: rgba(255, 255, 255, 0.08);
  --bg-accent-1: rgba(96, 165, 250, 0.26);
  --bg-accent-2: rgba(52, 211, 153, 0.18);
  --text: #f4f7fb;
  --muted: #b1bfd6;
  --line: rgba(255, 255, 255, 0.14);
  --success: #86efac;
  --danger: #fca5a5;
}

.hero,
.toolbox,
.tree-panel {
  padding: 1.4rem;
}

.workspace {
  margin-top: 1.25rem;
}

.tool-row {
  align-items: end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sort-toggle {
  margin-bottom: 0.1rem;
}

.button-row {
  justify-content: flex-end;
  margin-left: auto;
}

.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.9rem;
}

.pane {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.editor-shell,
.output-shell {
  height: 520px;
  min-height: 320px;
}

.output-shell .line-numbers {
  min-width: 3.75rem;
  padding: 1.15rem 0.75rem 1.15rem 1rem;
  font-size: 0.95rem;
}

.output-shell .output-block {
  padding: 1.15rem 1.2rem;
  font-size: 0.95rem;
}

.tree-panel {
  margin-top: 1.25rem;
}

.summary-row {
  align-items: flex-start;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tree-root {
  height: 420px;
  min-height: 320px;
  padding: 1.15rem 1.2rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-surface-strong) 82%, white 18%);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: auto;
}

.tree-empty {
  margin: 0;
  color: var(--muted);
}

.json-key {
  color: #93c5fd;
}

.json-string {
  color: #be185d;
}

.json-number {
  color: #b45309;
}

.json-boolean {
  color: #0369a1;
}

.json-null {
  color: #7c3aed;
}

.tree-node {
  margin-left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.93rem;
  line-height: 1.65;
}

.tree-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  white-space: nowrap;
}

.tree-toggle {
  width: 1.3rem;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tree-toggle.is-hidden {
  visibility: hidden;
}

.tree-children[hidden] {
  display: none;
}

.tree-label {
  color: #93c5fd;
}

.tree-meta {
  color: var(--muted);
}

@media (max-width: 1080px) {
  .button-row {
    justify-content: flex-start;
    margin-left: 0;
  }

  .panes {
    grid-template-columns: 1fr;
  }

  .tree-toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .hero,
  .toolbox,
  .tree-panel {
    padding: 1rem;
  }

  .editor-shell,
  .output-shell,
  .tree-root {
    height: 320px;
  }
}
