:root {
  color-scheme: dark;
  --bg: #100f16;
  --header: #15141d;
  --surface: #191822;
  --editor: #15141e;
  --subtle-surface: #1d1b27;
  --hover: #262334;
  --line: #2d2a3b;
  --strong-line: #3b354c;
  --text: #f2eff9;
  --muted: #a7a1b8;
  --dim: #888197;
  --accent: #a990ff;
  --accent-strong: #ab92ff;
  --accent-ink: #1c1335;
  --accent-bg: #2a2240;
  --accent-hover: #bba7ff;
  --green: #83dcb3;
  --red: #ff9eaa;
  --orange: #e9b17e;
  --code-key: #c1aaff;
  --code-string: #98dcb8;
  --code-number: #efbe8a;
  --code-literal: #a8befa;
  --code-punctuation: #a4a0b9;
  --selection: #7355ba6b;
  --shadow: 0 15px 38px #08070e45, 0 2px 5px #08070e30;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4fa;
  --header: #fff;
  --surface: #fff;
  --editor: #fcfbfe;
  --subtle-surface: #f8f6fc;
  --hover: #efeaf8;
  --line: #e4deed;
  --strong-line: #d7cce5;
  --text: #252033;
  --muted: #655b76;
  --dim: #756985;
  --accent: #6743b0;
  --accent-strong: #714bc0;
  --accent-ink: #fff;
  --accent-bg: #eee6fa;
  --accent-hover: #5f38aa;
  --green: #187850;
  --red: #ad354d;
  --orange: #945312;
  --code-key: #6338a5;
  --code-string: #237a4b;
  --code-number: #9a4b18;
  --code-literal: #3f5fac;
  --code-punctuation: #6f647d;
  --selection: #bda4f084;
  --shadow: 0 14px 30px #3120480b, 0 2px 4px #3120480d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
body::before {
  position: absolute;
  z-index: -1;
  top: 64px;
  left: 0;
  right: 0;
  height: 285px;
  background: radial-gradient(ellipse at 44% -35%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 75%);
  content: "";
  pointer-events: none;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .34; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
svg { display: block; width: 17px; height: 17px; flex: none; }
[data-icon] { flex: none; }
.site-header { height: 64px; border-bottom: 1px solid var(--line); background: var(--header); }
.header-inner, .main { width: min(100% - 88px, 1500px); margin: 0 auto; }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 730; letter-spacing: -.055em; }
.brand-accent { color: var(--accent); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--accent-ink); background: var(--accent-strong); }
.brand-mark svg { width: 22px; height: 22px; stroke-width: 1.85; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.button { padding: 0 11px; }
.icon-button { width: 34px; padding: 0; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { color: var(--text); background: var(--hover); border-color: var(--strong-line); }
.primary { color: var(--accent-ink); background: var(--accent-strong); border-color: var(--accent-strong); }
.primary:hover:not(:disabled) { color: var(--accent-ink); background: var(--accent-hover); border-color: var(--accent-hover); }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 38px 0 25px; }
.heading h1 { margin: 0; font-size: clamp(30px, 3.4vw, 49px); line-height: 1.14; letter-spacing: -.06em; font-weight: 760; }
.heading h1 span { color: var(--accent); }
.heading p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.heading .primary { min-height: 42px; padding: 0 16px; margin-bottom: 1px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent-strong) 21%, transparent); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr); align-items: stretch; }
.panel {
  container-type: inline-size;
  min-width: 0;
  height: max(525px, calc(100dvh - 254px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel-header, .view-bar, .tool-bar, .search-bar, .panel-footer { flex: none; display: flex; align-items: center; }
.panel-header { min-height: 68px; gap: 10px; padding: 0 15px; }
.document-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); border-radius: 9px; background: var(--accent-bg); color: var(--accent); }
#output-panel .document-icon { color: var(--green); background: color-mix(in srgb, var(--green) 9%, var(--surface)); border-color: color-mix(in srgb, var(--green) 17%, var(--line)); }
.document { flex: 1; min-width: 0; }
.document h2 { margin: 0 0 4px; font-size: 14px; line-height: 1.15; font-weight: 700; }
.file-name { color: var(--dim); font: 11px/1.15 var(--mono); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.open-button svg { width: 15px; height: 15px; }
.view-bar { justify-content: space-between; min-height: 43px; border-block: 1px solid var(--line); padding: 0 11px 0 13px; gap: 4px; }
.tabs { align-self: stretch; display: flex; gap: 5px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  min-width: 66px;
  justify-content: center;
  padding: 0 9px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab[aria-selected="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tab[aria-selected="true"]::after { content: ""; height: 2px; border-radius: 2px 2px 0 0; position: absolute; inset: auto 0 0; background: var(--accent); }
.view-actions, .content-tools, .code-tools, .tree-tools { display: flex; align-items: center; gap: 3px; }
.view-actions .icon-button, .content-tools .icon-button, .search-bar .icon-button { border-color: transparent; min-height: 29px; width: 29px; }
.view-actions svg, .content-tools svg, .search-bar svg { width: 15px; height: 15px; }
.tool-bar { justify-content: space-between; gap: 4px; min-height: 43px; padding: 0 11px; border-bottom: 1px solid var(--line); background: var(--subtle-surface); }
.tool-button { min-height: 28px; border: 1px solid transparent; padding: 0 7px; gap: 6px; font-size: 12px; }
.tool-button svg { width: 14px; height: 14px; }
.content-tools > [data-action="copy"] { margin-left: 5px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: 34px; right: 0; width: max-content; min-width: 160px; padding: 4px; border-radius: 8px; background: var(--surface); border: 1px solid var(--strong-line); box-shadow: var(--shadow); z-index: 3; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text); text-align: left; font-size: 13px; }
.menu button:hover { background: var(--hover); }
.search-bar { padding: 6px 11px; min-height: 42px; border-bottom: 1px solid var(--line); gap: 5px; }
.search-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--dim); }
.search-field input { flex: 1; width: 100%; min-width: 0; padding: 5px; border: 0; border-radius: 4px; background: var(--editor); color: var(--text); font-size: 13px; }
.search-count { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.panel-body { flex: 1; overflow: hidden; min-height: 0; background: var(--editor); }
.code-editor { height: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); }
.gutter { min-width: 49px; background: color-mix(in srgb, var(--editor) 60%, var(--subtle-surface)); border-right: 1px solid var(--line); color: var(--dim); text-align: right; overflow: hidden; user-select: none; }
.line-numbers { min-width: 48px; }
.line-numbers, .highlight, .code-input { margin: 0; padding: 14px 13px; font: 13px/23px var(--mono); font-kerning: none; font-variant-ligatures: none; letter-spacing: 0; tab-size: 2; }
.line-numbers, .highlight { white-space: pre; }
.code-content { position: relative; min-width: 0; min-height: 0; }
.highlight, .code-input { position: absolute; inset: 0; min-width: 0; width: 100%; height: 100%; border: 0; border-radius: 0; text-align: left; }
.highlight { pointer-events: none; overflow: hidden; color: var(--text); }
.code-input { display: block; resize: none; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--text); overflow: auto; white-space: pre; }
.code-input:focus { outline: none; }
.code-content:focus-within { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent); }
.code-input::selection { background: var(--selection); }
.code-key { color: var(--code-key); }
.code-string { color: var(--code-string); }
.code-number { color: var(--code-number); }
.code-literal { color: var(--code-literal); }
.code-punctuation { color: var(--code-punctuation); }
.code-invalid { color: var(--red); }
.structured { height: 100%; overflow: auto; padding: 12px 13px; }
.tree-root { width: max-content; min-width: 100%; }
.tree-row { display: flex; align-items: center; position: relative; min-height: 28px; gap: 6px; padding-left: calc(var(--depth) * 19px); font: 12px/1.5 var(--mono); white-space: nowrap; border-radius: 5px; }
.tree-row:hover { background: var(--subtle-surface); }
.tree-row::before { position: absolute; inset: 0 auto 0 23px; width: max(0px, calc((var(--depth) - 1) * 19px)); content: ""; background: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 19px); pointer-events: none; }
.tree-row > * { position: relative; }
.tree-toggle { flex: none; display: grid; place-items: center; width: 20px; height: 24px; padding: 0; border: 0; border-radius: 4px; color: var(--dim); background: transparent; }
.tree-toggle svg { width: 12px; height: 12px; }
.tree-toggle:hover, .tree-action:hover { color: var(--text); background: var(--hover); }
.tree-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); opacity: .63; }
.tree-name { color: var(--code-key); }
.tree-index, .tree-size { color: var(--dim); }
.tree-kind { color: var(--code-punctuation); }
.tree-size { margin-left: 3px; }
.tree-actions { display: flex; align-items: center; padding: 0 3px; opacity: 0; }
.tree-row:is(:hover,:focus-within) .tree-actions { opacity: 1; }
.tree-action { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; color: var(--dim); background: transparent; }
.tree-action svg { width: 13px; height: 13px; }
.table-view { width: 100%; border-collapse: separate; border-spacing: 0; font: 12px/1.5 var(--mono); }
.table-view :is(th,td) { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-view th { position: sticky; top: -12px; background: var(--subtle-surface); z-index: 1; color: var(--muted); white-space: nowrap; }
.table-cell { display: block; padding: 0; max-width: 350px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; border: 0; border-radius: 4px; background: transparent; font: inherit; }
.table-cell:hover { background: var(--hover); }
.structured-empty { margin: 15px 6px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel-footer { justify-content: space-between; gap: 10px; min-height: 39px; border-top: 1px solid var(--line); padding: 0 14px; font-size: 11px; }
.validation { min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; }
.validation span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.validation svg { width: 14px; height: 14px; }
.validation.invalid { color: var(--red); }
.metrics { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.transfer { align-self: center; display: grid; place-items: center; justify-content: center; gap: 8px; }
.transfer-group { display: grid; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.transfer .icon-button { width: 35px; min-height: 34px; border: 0; color: var(--accent); background: var(--surface); border-radius: 8px; }
.transfer .icon-button:hover { background: var(--accent-bg); color: var(--accent); }
.transfer .icon-button + .icon-button { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.transfer-group .icon-button:first-child { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.transfer .swap { color: var(--dim); border: 1px solid var(--line); }
.workspace.focused { display: block; }
.workspace.focused .transfer, .workspace.focused .panel:not(.focused-panel) { display: none; }
.footer { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 11px; }
.footer-local, .footer-shortcuts, .footer-shortcuts span { display: flex; gap: 7px; align-items: center; }
.footer-local svg { width: 14px; height: 14px; }
.footer-shortcuts { gap: 18px; }
.footer-shortcuts span { gap: 4px; }
.footer-link { color: inherit; }
.ad-placement { margin: 14px auto 26px; width: min(100%, 970px); color: var(--muted); font-size: 11px; }
.ad-placement > p { margin: 0 0 7px; }
.ad-placement > ins { display: block; }
.ad-placement:has(> ins[data-ad-status="unfilled"]) { display: none; }
.privacy-page { max-width: 730px; margin: 0 auto; padding: 35px 0; line-height: 1.6; }
.privacy-page a { color: var(--accent); }
kbd { display: inline-grid; min-width: 18px; height: 19px; padding: 0 4px; place-content: center; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font: 10px var(--mono); }
.comparison { margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.comparison-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); }
.comparison h2, .dialog-heading h2 { margin: 0; font-size: 16px; }
.comparison p { color: var(--muted); margin: 5px 0 0; font-size: 13px; line-height: 1.5; }
.diff-list { overflow: auto; }
.diff-table { border-collapse: collapse; width: 100%; table-layout: fixed; font: 12px/1.5 var(--mono); }
.diff-table :is(th,td) { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }
.diff-table tr:last-child td { border-bottom: 0; }
.diff-table th { background: var(--subtle-surface); color: var(--muted); }
.diff-table :is(th,td):first-child { width: 25%; color: var(--accent); }
.diff-table pre { margin: 0; white-space: pre-wrap; font: inherit; }
.diff-old { color: var(--red); }
.diff-new { color: var(--green); }
.diff-empty { padding: 12px 15px 16px; }
dialog { width: min(465px, calc(100% - 32px)); border: 1px solid var(--strong-line); border-radius: 13px; padding: 16px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: #0b0813aa; backdrop-filter: blur(2px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shortcut-list { margin: 0; font-size: 13px; }
.shortcut-list div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.shortcut-list dd { display: flex; gap: 4px; margin: 0; }
#node-form label { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
#node-form :is(input,textarea) { padding: 8px 9px; color: var(--text); background: var(--editor); border: 1px solid var(--line); border-radius: 6px; font: 13px/1.5 var(--mono); }
#node-value { resize: vertical; }
.dialog-error { color: var(--red); font-size: 13px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; z-index: 4; bottom: 19px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 30px); border: 1px solid var(--strong-line); border-radius: 8px; padding: 10px 14px; background: var(--surface); color: var(--text); font-size: 13px; box-shadow: var(--shadow); text-align: center; }
@media (hover: none) { .tree-actions { opacity: 1; } }
@media (max-width: 1050px) { .header-inner, .main { width: calc(100% - 50px); } }
@media (max-width: 900px) {
  .header-inner, .main { width: calc(100% - 30px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 45px minmax(0, 1fr); }
  .panel-header { padding-inline: 10px; }
  .view-bar, .tool-bar { padding-inline: 6px; }
  .tabs { gap: 2px; }
  .tab { min-width: 56px; padding-inline: 7px; }
  .tool-button { padding-inline: 5px; }
  .content-tools { gap: 1px; }
  .content-tools > [data-action="copy"] { margin-left: 2px; }
  .gutter, .line-numbers { min-width: 37px; }
  .line-numbers { padding-inline: 9px; }
}
@media (max-width: 600px) {
  .heading { padding: 27px 0 20px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel { height: 490px; }
  .transfer { display: flex; gap: 7px; padding: 9px 0; }
  .transfer-group { display: flex; }
  .transfer-group .icon-button { border-radius: 7px !important; min-height: 32px; }
  .transfer .icon-button + .icon-button { border: 0; border-left: 1px solid var(--line); }
  .transfer-group svg { transform: rotate(90deg); }
  .workspace.focused .panel { height: max(490px, calc(100dvh - 235px)); }
}
@media (max-width: 500px) {
  .site-header { height: 57px; }
  .heading { align-items: start; flex-direction: column; gap: 13px; }
  .heading h1 { font-size: 34px; }
  .heading .primary { min-height: 36px; }
  .panel-header { min-height: 59px; padding: 0 10px; }
  .panel { height: 455px; }
  .tool-bar { padding-inline: 6px; }
  .view-bar { padding-inline: 6px; }
  .footer { justify-content: center; }
  .footer-shortcuts { display: none; }
}
@container (max-width: 320px) {
  .panel-header { gap: 7px; }
  .document-icon { width: 33px; height: 33px; }
  .open-button { padding-inline: 8px; }
  .open-button > [data-icon], .tool-button > [data-icon] { display: none; }
  .content-tools .icon-button { width: 27px; }
  .tool-bar { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; } }

::highlight(input-panel), ::highlight(output-panel) { background-color: var(--selection); color: var(--text); }
.load-more { margin: 8px 5px 4px; }
