:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --text: #17201d;
  --muted: #5c6863;
  --border: #d9dfdb;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #1a7f37;
  --warn: #9a6700;
  --k: #7c3aed;
  --s: #0f766e;
  --n: #c2410c;
  --b: #1d4ed8;
  --z: #6b7280;
  --mark: #fde68a;
  --radius: 10px;
  --mono: 'JetBrains Mono', 'Noto Sans Bengali', 'Hind Siliguri', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1413; --surface: #161d1b; --surface-2: #1d2624; --text: #e6ece9; --muted: #98a5a0;
    --border: #2a3532; --accent: #2dd4bf; --accent-ink: #062320; --danger: #f87171; --ok: #4ade80;
    --warn: #fbbf24; --k: #c4b5fd; --s: #5eead4; --n: #fdba74; --b: #93c5fd; --z: #9ca3af; --mark: #854d0e;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1413; --surface: #161d1b; --surface-2: #1d2624; --text: #e6ece9; --muted: #98a5a0;
  --border: #2a3532; --accent: #2dd4bf; --accent-ink: #062320; --danger: #f87171; --ok: #4ade80;
  --warn: #fbbf24; --k: #c4b5fd; --s: #5eead4; --n: #fdba74; --b: #93c5fd; --z: #9ca3af; --mark: #854d0e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 'Hind Siliguri', system-ui, sans-serif;
  max-width: 1200px; margin-inline: auto; padding: 0 16px;
}
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.brand strong { display: block; font-size: 1.25rem; line-height: 1.2; }
.brand small { color: var(--muted); font-size: .85rem; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 15px var(--mono); }
.top-nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top-nav a:hover { color: var(--text); }
.top-nav .pill { color: var(--accent); border: 1px solid var(--accent); padding: 3px 12px; border-radius: 999px; }

.ad-slot { min-height: 90px; margin: 8px 0 14px; border: 1px dashed var(--border); border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); font-size: .8rem; overflow: hidden; }
.ad-slot.ad-bottom { margin-top: 14px; }

.app { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tab { border: 0; background: none; padding: 10px 18px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }

.toolbar, .tree-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); align-items: center; }
.toolbar .sep { flex: 1; }
button, select, input[type="search"] {
  font: inherit; font-size: .92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 12px; min-height: 34px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); }
button.small { padding: 1px 8px; min-height: 26px; font-size: .8rem; }

.panel textarea { display: block; width: 100%; height: 60vh; min-height: 320px; border: 0; resize: vertical; padding: 14px; background: var(--surface); color: var(--text); font: 14px/1.55 var(--mono); tab-size: 2; }
.panel textarea:focus { outline: none; }
.panel.dragover textarea { background: var(--surface-2); }

.tree { height: 60vh; min-height: 320px; overflow: auto; padding: 10px 14px; font: 14px/1.7 var(--mono); }
.tree details { padding-left: 18px; }
.tree > details, .tree > .leaf { padding-left: 0; }
.tree summary { cursor: pointer; list-style: none; margin-left: -16px; }
.tree summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--muted); transition: transform .12s; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary::-webkit-details-marker { display: none; }
.tree .leaf { padding-left: 18px; white-space: pre-wrap; word-break: break-word; }
.tree .key { color: var(--k); cursor: pointer; }
.tree .key:hover { text-decoration: underline; }
.tree .meta { color: var(--muted); font-size: .85em; }
.tree .str { color: var(--s); } .tree .num { color: var(--n); } .tree .bool { color: var(--b); } .tree .null { color: var(--z); font-style: italic; }
.tree mark { background: var(--mark); color: inherit; border-radius: 2px; }
.tree .empty { color: var(--muted); font-family: 'Hind Siliguri', sans-serif; }
.path-wrap { margin-left: auto; color: var(--muted); font-size: .88rem; display: flex; gap: 6px; align-items: center; min-width: 0; }
.path-wrap code { max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status { padding: 8px 14px; border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); background: var(--surface-2); }
.status.ok { color: var(--ok); } .status.err { color: var(--danger); } .status.warn { color: var(--warn); }
.status small { display: block; opacity: .8; font-family: var(--mono); font-size: .78rem; }

.content { max-width: 760px; margin: 28px auto; }
.content h2 { margin-top: 32px; }
.content details { border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; margin: 8px 0; background: var(--surface); }
.content summary { cursor: pointer; font-weight: 600; }
.premium { border: 1px solid var(--accent); border-radius: var(--radius); padding: 4px 20px 10px; background: var(--surface); }

.site-footer { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 24px 0 40px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-size: .9rem; z-index: 10; }

@media (max-width: 640px) {
  .toolbar .sep { display: none; }
  .path-wrap { margin-left: 0; width: 100%; }
  .brand small { display: none; }
  .panel textarea, .tree { height: 55vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
