:root {
  --ink: #24211d;
  --muted: #777169;
  --paper: #f7f4ee;
  --panel: #fffdf9;
  --line: #d9d3c8;
  --accent: #dc6d4b;
  --accent-dark: #b84f32;
  --blue: #5477aa;
  --green: #4c8068;
  --purple: #8a5c91;
  --shadow: 0 20px 50px rgba(54, 45, 35, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 15%, rgba(220, 109, 75, 0.08), transparent 28rem),
    linear-gradient(rgba(36, 33, 29, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 33, 29, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 32px 32px, 32px 32px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; background: none; }

.site-header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--ink); border-radius: 50%; font: 700 0.72rem ui-monospace, monospace; }

main { max-width: 1400px; margin: 0 auto; padding: 32px 42px 80px; }

.workspace { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: stretch; }
.panel { min-width: 0; min-height: 590px; display: flex; flex-direction: column; overflow: hidden; background: rgba(255, 253, 249, 0.94); border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel-header, .panel-footer { min-height: 76px; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.panel-header > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.panel-header h2 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.actions { display: flex; align-items: center; gap: 8px; }

.text-button { padding: 7px; color: var(--muted); font-size: 0.8rem; }
.text-button:hover { color: var(--ink); }
.primary-button, .secondary-button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); background: var(--panel); font-size: 0.77rem; font-weight: 700; transition: 150ms ease; }
.primary-button { color: white; border-color: var(--ink); background: var(--ink); }
.primary-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary-button:hover { border-color: var(--ink); }

.editor-wrap { flex: 1; display: grid; grid-template-columns: auto 1fr; min-height: 430px; overflow: hidden; background: #fbfaf7; }
.line-numbers { min-width: 48px; padding: 24px 13px; overflow: hidden; color: #aaa39a; border-right: 1px solid #ebe6de; text-align: right; white-space: pre; font: 0.78rem/1.72 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: none; }
textarea { width: 100%; height: 100%; min-height: 430px; resize: none; padding: 24px 20px; color: var(--ink); background: transparent; border: 0; outline: 0; tab-size: 2; font: 0.84rem/1.72 ui-monospace, SFMono-Regular, Consolas, monospace; }
.status { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 0.76rem; font-weight: 650; }
.status-dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 4px rgba(76, 128, 104, 0.1); }
.status.invalid { color: #bc493f; }

.tree { flex: 1; min-height: 430px; padding: 22px 18px 28px; overflow: auto; background: #fbfaf7; font: 0.82rem/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }
.tree-row { display: flex; min-width: max-content; align-items: baseline; border-radius: 3px; }
.tree-row:hover { background: rgba(36, 33, 29, 0.035); }
.toggle { width: 22px; height: 22px; padding: 0; color: var(--muted); font-size: 0.66rem; transform-origin: center; }
.toggle-placeholder { display: inline-block; width: 22px; }
.tree-key { color: var(--blue); }
.tree-key::after { content: ":"; color: var(--ink); margin-right: 7px; }
.tree-value { border: 1px solid transparent; border-radius: 3px; }
.tree-value.editable { cursor: text; }
.tree-value.editable:hover { border-color: var(--line); }
.type-string { color: var(--green); }
.type-number { color: var(--purple); }
.type-boolean { color: var(--accent-dark); }
.type-null { color: #989188; font-style: italic; }
.bracket, .summary { color: var(--muted); }
.summary { margin-left: 7px; font-size: 0.74rem; }
.children { margin-left: 11px; padding-left: 11px; border-left: 1px solid #e3ded5; }
.node.collapsed > .children, .node.collapsed > .closing { display: none; }
.node.collapsed > .tree-row .toggle { transform: rotate(-90deg); }
.node:not(.collapsed) > .tree-row .summary { display: none; }
.closing { padding-left: 22px; color: var(--muted); }
.inline-editor { min-width: 90px; padding: 2px 5px; color: var(--ink); background: white; border: 1px solid var(--accent); outline: 0; font: inherit; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .site-header, main { padding-left: 18px; padding-right: 18px; }
  main { padding-top: 18px; }
  .panel-header, .panel-footer { padding: 14px; }
  .panel-footer { align-items: flex-start; flex-direction: column; }
  .panel-footer .actions { align-self: stretch; }
  .panel-footer button { flex: 1; }
}
