/* JSON Formatter: one dark theme, system fonts, no external files. */

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-raised: #283548;
  --well: #0b1324;
  --line: #334155;
  --line-soft: rgba(148, 163, 184, 0.16);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #fcd34d;
  --accent-strong: #fbbf24;
  --accent-ink: #1c1917;
  --accent-soft: rgba(252, 211, 77, 0.13);
  --accent-line: rgba(252, 211, 77, 0.5);
  --danger: #f87171;
  --danger-text: #fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.2);
  --danger-band: rgba(248, 113, 113, 0.1);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.13);
  --tok-key: #93c5fd;
  --tok-string: #86efac;
  --tok-number: #fdba74;
  --tok-boolean: #c4b5fd;
  --tok-null: #f9a8d4;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(2, 6, 23, 0.45), 0 14px 34px rgba(2, 6, 23, 0.34);
  --fast: 150ms;
  --medium: 220ms;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --code-size: 13px;
  --line-h: 20px;
  --row-h: 34px;
  --toggle-w: 26px;
  --tap: 40px;
  --split: 0.5;
}

/* Bigger text and rows on small or touch screens: 16px keeps mobile browsers from zooming in. */
@media (max-width: 720px) {
  :root {
    --row-h: 40px;
    --toggle-w: 40px;
  }
}

@media (pointer: coarse) {
  :root {
    --code-size: 16px;
    --line-h: 24px;
    --row-h: 40px;
    --toggle-w: 40px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1100px 520px at 0% -12%, rgba(252, 211, 77, 0.07), transparent 62%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.offscreen {
  position: fixed;
  top: 0;
  left: -10000px;
  opacity: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast), color var(--fast), transform var(--fast);
}

.btn:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: #475569;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn[aria-pressed="true"],
.btn[aria-pressed="true"]:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-primary,
.btn-primary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
}

/* A count on a toolbar button sits on its corner, so showing it never makes the toolbar wrap. */
.btn-badged {
  position: relative;
}

.btn-badged .count {
  position: absolute;
  top: -8px;
  right: -8px;
  box-shadow: 0 0 0 2px var(--bg);
}

.segmented {
  gap: 0;
}

.segmented .btn {
  border-radius: 0;
}

.segmented .btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.segmented .btn:last-child {
  margin-left: -1px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.segmented .btn[aria-pressed="true"] {
  position: relative;
  z-index: 1;
}

.switch {
  gap: 10px;
}

.switch-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #475569;
  transition: background-color var(--medium);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8fafc;
  transition: transform var(--medium), background-color var(--medium);
}

.switch[aria-checked="true"] {
  border-color: var(--accent-line);
}

.switch[aria-checked="true"] .switch-track {
  background: var(--accent);
}

.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(14px);
  background: var(--accent-ink);
}

.select {
  position: relative;
  display: inline-flex;
}

.select select {
  min-height: var(--tap);
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  transition: border-color var(--fast), background-color var(--fast);
}

.select select:hover {
  border-color: #475569;
  background: var(--surface-raised);
}

.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select option {
  background: var(--surface);
  color: var(--text);
}

/* Header, toolbar and footer */

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}

.brand {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 40px;
  height: 40px;
  flex: none;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.header-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.btn-lang {
  padding: 0 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 4px 16px 14px;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-files {
  margin-left: auto;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 6px 16px 10px;
  color: var(--muted);
  font-size: 13px;
}

.app-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 4px;
  transition: color var(--fast);
}

.app-footer a:hover {
  color: var(--accent);
}

.shortcuts {
  font-size: 12px;
}

@media (max-width: 639px) {
  .tagline {
    display: none;
  }
}

/* On narrow screens these buttons show only their icon; the label stays for screen readers. */
@media (max-width: 599px) {
  .tool-files .btn-label,
  .tree-tools .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .tool-files .btn,
  .tree-tools .btn {
    padding: 0;
  }
}

@media (max-width: 479px) {
  .app-header .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .app-header .btn {
    padding: 0;
  }
}

@media (max-width: 899px), (pointer: coarse) {
  .shortcuts {
    display: none;
  }
}

/* Workspace: the panes stack on phones and sit side by side, with a splitter, on wide screens. */

.workspace {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 0 16px;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pane-input {
  height: 360px;
}

.pane-output {
  height: 540px;
}

.splitter {
  display: none;
}

@media (min-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, calc(var(--split) * (100% - 16px))) 16px minmax(0, 1fr);
    align-content: stretch;
    gap: 0;
  }

  .pane-input,
  .pane-output {
    height: auto;
    min-height: 420px;
  }

  .splitter {
    display: block;
    position: relative;
    cursor: col-resize;
    touch-action: none;
  }

  .splitter::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 44px;
    border-radius: 2px;
    background: var(--line);
    transform: translate(-50%, -50%);
    transition: background-color var(--fast), height var(--medium);
  }

  .splitter:hover::before,
  .splitter:focus-visible::before,
  .splitter.is-dragging::before {
    height: 72px;
    background: var(--accent);
  }

  .splitter:focus-visible {
    outline: none;
  }
}

/* On touch screens the splitter grabs a 40px wide strip, wider than the gap it sits in. */
@media (min-width: 900px) and (pointer: coarse) {
  .splitter {
    z-index: 2;
  }

  .splitter::after {
    content: "";
    position: absolute;
    inset: 0 -12px;
  }
}

@media (min-width: 900px) and (min-height: 620px) {
  body {
    height: 100vh;
    height: 100dvh;
  }

  .pane-input,
  .pane-output {
    min-height: 0;
  }
}

.pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-height: 52px;
  padding: 8px 14px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.pane-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  transition: background-color var(--medium), color var(--medium);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status[data-status="valid"] {
  background: var(--success-soft);
  color: var(--success);
}

.status[data-status="invalid"] {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.stats {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* Editor: a transparent textarea over the error band and box, next to a virtual gutter. */

.editor {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--well);
  font-family: var(--mono);
  font-size: var(--code-size);
  line-height: var(--line-h);
  tab-size: 4;
  transition: box-shadow var(--fast);
}

.editor:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.gutter {
  position: relative;
  flex: none;
  width: calc(var(--digits, 1) * 1ch + 24px);
  min-width: 36px;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  color: var(--faint);
  text-align: right;
  user-select: none;
}

.gutter-lines {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  will-change: transform;
}

.gutter-line {
  height: var(--line-h);
  padding-right: 10px;
}

.gutter-line.is-error {
  background: var(--danger-band);
  color: var(--danger);
  font-weight: 700;
}

.editor-body {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.editor-text {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px 14px;
  overflow: auto;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  white-space: pre;
  resize: none;
  caret-color: var(--accent);
}

.editor-text:focus-visible {
  outline: none;
}

.mark-line {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: var(--line-h);
  background: var(--danger-band);
  pointer-events: none;
}

.mark-char {
  position: absolute;
  top: 0;
  left: 0;
  height: var(--line-h);
  border-radius: 3px;
  background: var(--danger-soft);
  box-shadow: inset 0 -2px 0 var(--danger);
  pointer-events: none;
}

.measure {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  white-space: pre;
  pointer-events: none;
}

.editor-hint {
  position: absolute;
  top: 10px;
  right: 14px;
  left: 14px;
  margin: 0;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
}

/* The panel under the input: a syntax error, or the fixes Repair will make. */

.problem {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 10px;
  max-height: 50%;
  overflow-y: auto;
  padding: 10px 12px 10px 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
  animation: rise var(--medium) ease-out;
}

/* The fixes list runs under the title at full width, so the Repair button never squeezes it. */
.problem[data-tone="info"] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 2px;
}

.problem[data-tone="info"] .problem-body {
  display: contents;
}

.problem[data-tone="info"] .problem-icon {
  grid-area: 1 / 1;
}

.problem[data-tone="info"] .problem-message {
  grid-area: 1 / 2;
}

.problem[data-tone="info"] .problem-repair {
  grid-area: 1 / 3;
}

.problem[data-tone="info"] .problem-fixes {
  grid-area: 2 / 2 / 3 / 4;
}

.problem[data-tone="error"] {
  border-top-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(var(--danger-band), var(--danger-band)), var(--surface);
}

.problem[data-tone="info"] {
  border-top-color: rgba(252, 211, 77, 0.3);
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface);
}

.problem-icon {
  margin-top: 1px;
  color: var(--danger);
}

.problem[data-tone="info"] .problem-icon {
  color: var(--accent);
}

.problem-body {
  flex: 1;
  min-width: 0;
}

.problem-message {
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.problem-hint {
  margin: 4px 0 0;
  color: var(--muted);
}

.problem-fixes {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.problem-fixes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
}

.problem-goto {
  flex: none;
  min-height: var(--tap);
  padding: 0 10px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 8px;
  background: transparent;
  color: var(--danger-text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--fast);
}

.problem-goto:hover {
  background: var(--danger-band);
}

.problem-fixes .problem-goto {
  min-height: 32px;
  border-color: var(--accent-line);
  color: var(--accent);
}

.problem-fixes .problem-goto:hover {
  background: var(--accent-soft);
}

/* Full-size tap targets for the compact panel buttons on touch and narrow screens. */
@media (max-width: 720px), (pointer: coarse) {
  .btn-small,
  .problem-fixes .problem-goto {
    min-height: var(--tap);
  }
}

/* Output: tabs, notices and panels */

.tabs {
  display: flex;
  flex: none;
  gap: 4px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color var(--fast), background-color var(--fast);
}

.tab:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--text);
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

.stale {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(252, 211, 77, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.stale .icon {
  width: 16px;
  height: 16px;
}

.panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.empty-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: var(--well);
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  max-width: 34ch;
  margin: 0;
}

.empty-art {
  width: 56px;
  height: 56px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.code {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 12px 16px;
  overflow: auto;
  background: var(--well);
  color: #cbd5e1;
  font-family: var(--mono);
  font-size: var(--code-size);
  line-height: var(--line-h);
  tab-size: 4;
}

.code.is-wrapped {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

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

.tok-string {
  color: var(--tok-string);
}

.tok-number {
  color: var(--tok-number);
}

.tok-boolean {
  color: var(--tok-boolean);
}

.tok-null {
  color: var(--tok-null);
  font-style: italic;
}

/* Tree */

.tree-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.query {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--well);
  transition: border-color var(--fast);
}

.query:focus-within {
  border-color: var(--accent-line);
}

.query-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 40px tall over the label's 1px border, so the label stays as tall as the buttons beside it. */
.query input {
  flex: 1;
  min-width: 0;
  height: var(--tap);
  margin-block: -1px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--mono);
  font-size: max(13.5px, var(--code-size));
}

.query input::placeholder {
  color: var(--faint);
}

.query-status {
  flex: none;
  margin: 0;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.query-status:empty {
  display: none;
}

.query-status[data-tone="error"] {
  color: var(--danger-text);
}

.tree {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--well);
  font-family: var(--mono);
  font-size: var(--code-size);
  outline: none;
}

.tree:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

.tree-space {
  position: relative;
  min-width: 100%;
}

.tree-row {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--row-h);
  padding: 0 14px 0 4px;
  border-left: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--fast);
}

.tree-row:hover {
  background: rgba(148, 163, 184, 0.07);
}

.tree-row.is-active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.tree-indent {
  flex: none;
  align-self: stretch;
  background-image: repeating-linear-gradient(to right, transparent 0 12px, var(--line-soft) 12px 13px, transparent 13px 16px);
}

.tree-toggle {
  display: grid;
  flex: none;
  align-self: stretch;
  place-items: center;
  width: var(--toggle-w);
  margin-right: -2px;
}

.tree-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--muted);
  transition: transform var(--fast);
}

.tree-toggle.is-open::before {
  transform: rotate(90deg);
}

.tree-toggle.is-leaf::before {
  width: 5px;
  height: 5px;
  border: 0;
  border-radius: 50%;
  background: #475569;
}

.tree-toggle:not(.is-leaf):hover::before {
  border-left-color: var(--accent);
}

/* A key keeps its full width up to a limit; the value is the part that gets cut short. */
.tree-key {
  flex: none;
  max-width: 55%;
  overflow: hidden;
  color: var(--tok-key);
  text-overflow: ellipsis;
}

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

.tree-root {
  color: var(--accent);
  font-weight: 700;
}

.tree-colon {
  margin-left: -5px;
  color: var(--muted);
}

.tree-value {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v-string {
  color: var(--tok-string);
}

.v-number {
  color: var(--tok-number);
}

.v-boolean {
  color: var(--tok-boolean);
}

.v-null {
  color: var(--tok-null);
  font-style: italic;
}

.tree-count {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.tree-badge {
  flex: none;
  padding: 0 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 750;
  line-height: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tree-type {
  flex: none;
  margin-left: auto;
  padding-left: 12px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 12px;
}

.pathbar {
  flex: none;
  margin: 0;
  padding: 9px 16px;
  overflow: hidden;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pathbar.has-path {
  color: var(--accent);
  font-family: var(--mono);
}

/* Diff */

.field-label {
  display: block;
  flex: none;
  padding: 10px 16px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-compare {
  flex: 0 0 40%;
  min-height: 120px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.diff-result {
  flex: 1;
  min-height: 0;
  padding: 12px 14px;
  overflow: auto;
}

.diff-note {
  margin: 0 0 6px;
  color: var(--muted);
}

.diff-note.is-error {
  color: var(--danger-text);
  font-weight: 650;
}

.diff-note.is-detail {
  font-size: 13px;
  font-weight: 500;
}

.diff-note.is-success {
  color: var(--success);
  font-weight: 650;
}

.diff-summary {
  margin: 0 0 10px;
  font-weight: 650;
}

.change-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.change {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  background: var(--well);
  font-size: 13px;
}

.change.is-added {
  border-left-color: var(--success);
}

.change.is-removed {
  border-left-color: var(--danger);
}

.change.is-changed {
  border-left-color: var(--accent);
}

.change-type {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.is-added .change-type {
  color: var(--success);
}

.is-removed .change-type {
  color: var(--danger-text);
}

.is-changed .change-type {
  color: var(--accent);
}

.change-path {
  color: var(--tok-key);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.change-values {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.change-before {
  color: var(--danger-text);
  text-decoration: line-through;
  text-decoration-color: rgba(252, 165, 165, 0.55);
}

.change-after {
  color: var(--tok-string);
}

.change-arrow {
  margin: 0 8px;
  color: var(--muted);
}

.change-more {
  padding: 4px 12px;
  color: var(--muted);
}

/* Overlays */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.8);
  pointer-events: none;
  animation: fade var(--medium) ease-out;
}

.drop-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 32px 40px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 650;
  text-align: center;
}

.drop-card p {
  margin: 0;
}

.drop-card .icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  box-shadow: var(--shadow);
  color: #0f172a;
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity var(--medium), transform var(--medium);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="error"] {
  background: #fecaca;
  color: #450a0a;
}

.toast:empty {
  visibility: hidden;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Phones: the toolbar becomes a tidy four-column grid. */
@media (max-width: 599px) {
  .toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .tool-group {
    display: contents;
  }

  .tool-group.segmented {
    display: flex;
    grid-column: 1 / -1;
  }

  .segmented .btn {
    flex: 1;
  }

  .tool-group > .btn,
  .tool-group > .select {
    grid-column: span 2;
    min-width: 0;
  }

  .tool-files > .btn {
    grid-column: span 1;
  }

  .toolbar .btn {
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .select select {
    width: 100%;
  }
}
