*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f7f9fc; --panel: #ffffff; --panel2: #f1f5f9;
  --border: #e3e8f0; --text: #0f172a; --text-muted: #5b6878;
  --brand: #b45309; --brand-dark: #D97706; --brand-light: #fef3c7;
  --green: #059669; --red: #dc2626; --blue: #2563eb;
  --str: #16a34a; --num: #2563eb; --bool: #db2777; --null-c: #5b6878; --key: #b45309;
  --radius: 8px; --shadow: 0 1px 3px rgba(15,23,42,.08);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* HEADER */
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1600px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; color: var(--brand); }
.header-badges { display: flex; gap: 6px; }
.badge { background: rgba(245,158,11,.15); color: var(--brand); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

/* TOOLBAR */
.toolbar { background: var(--panel2); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tool-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ttab { padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: none; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text-muted); transition: all .12s; }
.ttab.active { background: var(--brand); color: #000; border-color: var(--brand); }
.ttab:hover:not(.active) { background: rgba(15,23,42,.06); color: var(--text); }
.tool-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.indent-sel { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 6px 10px; font-size: 12px; font-family: inherit; cursor: pointer; }
.btn-tool { padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px; background: none; color: var(--text-muted); font-size: 12px; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-tool:hover { color: var(--text); border-color: var(--text-muted); }
.btn-primary-tool { padding: 7px 18px; background: var(--brand); border: none; border-radius: 6px; color: #000; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .12s; }
.btn-primary-tool:hover { background: var(--brand-dark); }

/* MAIN */
.app-main { max-width: 1600px; margin: 0 auto; padding: 16px 20px; }
.editor-layout { display: grid; grid-template-columns: 1fr 60px 1fr; gap: 0; min-height: 500px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 700px) { .editor-layout { grid-template-columns: 1fr; } }

/* PANES */
.editor-pane { display: flex; flex-direction: column; }
.pane-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel2); }
.pane-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.pane-actions { display: flex; gap: 6px; }
.btn-micro { padding: 4px 10px; border: 1px solid var(--border); border-radius: 5px; background: none; color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-micro:hover { color: var(--brand); border-color: var(--brand); }
.btn-micro.copied { background: var(--green); color: white; border-color: var(--green); }

.code-editor { flex: 1; resize: none; border: none; outline: none; background: var(--panel); color: var(--text); font-family: 'Courier New', 'Monaco', 'Consolas', monospace; font-size: 13px; line-height: 1.7; padding: 14px; min-height: 420px; }
.code-editor::placeholder { color: #64748b; }

.output-wrap { flex: 1; overflow: auto; position: relative; }
.code-output { padding: 14px; font-family: 'Courier New', 'Monaco', 'Consolas', monospace; font-size: 13px; line-height: 1.7; min-height: 420px; white-space: pre; overflow-x: auto; outline: none; }

/* Syntax highlighting */
.j-str { color: var(--str); }
.j-num { color: var(--num); }
.j-bool { color: var(--bool); }
.j-null { color: var(--null-c); }
.j-key { color: var(--key); }
.j-punct { color: var(--text-muted); }

.pane-footer { padding: 6px 14px; border-top: 1px solid var(--border); background: var(--panel2); font-size: 11px; color: var(--text-muted); }

/* DIVIDER */
.divider-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); padding: 12px 6px; background: var(--panel2); }
.status-bubble { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.status-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; }
.status-icon.ok { background: rgba(16,185,129,.2); color: var(--green); }
.status-icon.err { background: rgba(239,68,68,.2); color: var(--red); }
.status-icon.idle { background: rgba(148,163,184,.15); color: var(--text-muted); }
.status-text { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-align: center; }
.btn-swap { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 16px; cursor: pointer; color: var(--text-muted); transition: all .12s; }
.btn-swap:hover { color: var(--brand); border-color: var(--brand); }

/* ERROR */
.error-box { margin-top: 12px; background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.25); border-radius: var(--radius); padding: 12px 16px; color: #dc2626; font-family: monospace; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.error-icon { flex-shrink: 0; font-size: 16px; }

/* TREE VIEW */
.tree-view { padding: 14px; font-family: monospace; font-size: 13px; overflow: auto; }
.tree-node { margin-left: 18px; }
.tree-key { color: var(--key); }
.tree-val-str { color: var(--str); }
.tree-val-num { color: var(--num); }
.tree-val-bool { color: var(--bool); }
.tree-val-null { color: var(--null-c); }
.tree-toggle { cursor: pointer; user-select: none; color: var(--brand); }
.tree-toggle:hover { text-decoration: underline; }
.tree-collapsed .tree-children { display: none; }
.tree-count { color: var(--text-muted); font-size: 11px; }

/* GUIDE */
.guide-section { margin-top: 24px; }
.guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 800px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
.guide-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.guide-card h3 { font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.guide-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* FOOTER */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 16px 20px; color: var(--text-muted); font-size: 13px; line-height: 1.8; margin-top: 16px; }
.footer-small { font-size: 11px; color: #64748b; }
