/* ==========================================================================
   JSON Glance — styles
   ========================================================================== */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --border: #e3e6ee;
  --border-strong: #cdd2df;
  --fg: #171a23;
  --fg-muted: #5b6375;
  --fg-subtle: #8a91a3;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-fg: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #15803d;
  --ok-soft: #e7f6ed;
  --err: #c42b2b;
  --err-soft: #fdeeee;
  --hover: #f4f5fa;
  --sel: #e6e8ff;
  --sel-text: rgba(79, 70, 229, .22);
  --guide: #e6e8ef;
  --match: #ffe066;
  --match-row: #fff8d6;
  --match-cur: #ffeb99;
  --tok-key: #8a2be2;
  --tok-str: #0b7a4b;
  --tok-num: #c2410c;
  --tok-bool: #1d5fd6;
  --tok-null: #8a91a3;
  --tok-punct: #7a8193;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .22);
  --radius: 12px;
  --ind: 18px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f15;
    --surface: #13171f;
    --surface-2: #181d27;
    --border: #242a37;
    --border-strong: #353d4f;
    --fg: #e7eaf1;
    --fg-muted: #a3aabb;
    --fg-subtle: #6f778b;
    --accent: #8b8cff;
    --accent-2: #b07cff;
    --accent-fg: #0c0f15;
    --accent-soft: #1d2040;
    --ok: #4ade80;
    --ok-soft: #10281a;
    --err: #ff7b7b;
    --err-soft: #2d1416;
    --hover: #1a1f2a;
    --sel: #242a4a;
    --sel-text: rgba(139, 140, 255, .3);
    --guide: #222836;
    --match: #7a6400;
    --match-row: #2a2610;
    --match-cur: #4a3f00;
    --tok-key: #c9a2ff;
    --tok-str: #7ddca6;
    --tok-num: #ffb27a;
    --tok-bool: #7fb5ff;
    --tok-null: #7d8598;
    --tok-punct: #7d8598;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0f15;
  --surface: #13171f;
  --surface-2: #181d27;
  --border: #242a37;
  --border-strong: #353d4f;
  --fg: #e7eaf1;
  --fg-muted: #a3aabb;
  --fg-subtle: #6f778b;
  --accent: #8b8cff;
  --accent-2: #b07cff;
  --accent-fg: #0c0f15;
  --accent-soft: #1d2040;
  --ok: #4ade80;
  --ok-soft: #10281a;
  --err: #ff7b7b;
  --err-soft: #2d1416;
  --hover: #1a1f2a;
  --sel: #242a4a;
  --sel-text: rgba(139, 140, 255, .3);
  --guide: #222836;
  --match: #7a6400;
  --match-row: #2a2610;
  --match-cur: #4a3f00;
  --tok-key: #c9a2ff;
  --tok-str: #7ddca6;
  --tok-num: #ffb27a;
  --tok-bool: #7fb5ff;
  --tok-null: #7d8598;
  --tok-punct: #7d8598;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font-family: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.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;
}

/* ---------- App shell ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  min-height: 460px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
}
.brand-mark svg.i { width: 18px; height: 18px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand h1 small { font-weight: 500; color: var(--fg-muted); font-size: 13px; margin-left: 4px; }

.privacy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--ok); background: var(--ok-soft);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.privacy-pill svg.i { width: 14px; height: 14px; }

.topbar-actions { margin-left: auto; display: flex; gap: 2px; }

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--fg-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg.i { width: 16px; height: 16px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.tb-group { display: flex; align-items: center; gap: 6px; flex: none; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }
.tb-spacer { flex: 1; min-width: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg);
  font: 500 13px/1 var(--sans);
  white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.danger:hover { color: var(--err); }
.btn[aria-busy="true"] { opacity: .7; pointer-events: none; }

.select {
  height: 34px; padding: 0 28px 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a91a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--fg); font: 500 13px var(--sans);
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.select:hover { border-color: var(--border-strong); }

/* ---------- Ads ---------- */
.ad-wrap { display: flex; flex-direction: column; align-items: center; flex: none; }
.ad-label {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-subtle); margin-bottom: 3px; line-height: 1;
}
.ad-slot { overflow: hidden; }
.ad-slot > ins.adsbygoogle { display: block; width: 100%; height: 100%; }
.ad-slot.placeholder {
  display: grid; place-items: center;
  border: 1px dashed var(--border-strong); border-radius: 8px;
  color: var(--fg-subtle); font-size: 12px;
  background: repeating-linear-gradient(-45deg, transparent 0 10px, var(--surface-2) 10px 20px);
}
.ad-hidden { display: none !important; }
.ad-wrap:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

.ad-top { padding: 8px 16px 6px; }
.ad-top .ad-slot { width: 728px; max-width: 100%; height: 90px; }

.ad-rail { display: none; width: 160px; }
.ad-rail .ad-slot { width: 160px; height: 600px; }

.ad-content { margin: 32px auto; }
.ad-content .ad-slot { width: 100%; max-width: 728px; min-height: 100px; }

/* ---------- Mobile view tabs ---------- */
.mobile-tabs {
  display: none; gap: 4px; flex: none;
  margin: 8px 8px 0; padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 11px;
}
.mobile-tabs button {
  flex: 1; height: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--fg-muted);
  font: 600 13px var(--sans); cursor: pointer;
}
.mobile-tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.tab-badge { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.tab-badge.ok { background: var(--ok); }
.tab-badge.err { background: var(--err); }

/* ---------- Workspace ---------- */
.layout {
  flex: 1; min-height: 0;
  display: flex; gap: 12px;
  padding: 6px 12px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.workspace { flex: 1; min-width: 0; min-height: 0; display: flex; --split: 50%; }

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

.pane-head {
  display: flex; align-items: center; gap: 6px;
  height: 46px; padding: 0 8px 0 14px; flex: none;
  border-bottom: 1px solid var(--border);
}
.pane-title { font-weight: 650; font-size: 13px; }
.pane-meta { margin-left: auto; color: var(--fg-subtle); font: 12px var(--mono); white-space: nowrap; }

.splitter { flex: 0 0 12px; position: relative; cursor: col-resize; touch-action: none; }
.splitter::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 4px; height: 44px; border-radius: 2px;
  transform: translate(-50%, -50%);
  background: var(--border-strong); opacity: .7;
  transition: background-color .15s, height .15s;
}
.splitter:hover::after, .splitter.dragging::after, .splitter:focus-visible::after { background: var(--accent); opacity: 1; height: 64px; }
.splitter:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }

/* ---------- Editor ---------- */
.editor {
  --lh: 20px;
  flex: 1; min-height: 0;
  display: flex; position: relative;
  font: 13px/var(--lh) var(--mono);
}
.gutter {
  flex: none; overflow: hidden;
  min-width: calc(var(--digits, 2) * 1ch + 26px);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  color: var(--fg-subtle); text-align: right;
  user-select: none; -webkit-user-select: none;
}
.gutter-inner { padding: 10px 10px 10px 12px; white-space: pre; will-change: transform; }
.gutter-inner .err { color: var(--err); font-weight: 700; }

.code { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.code-layer { position: absolute; top: 0; left: 0; pointer-events: none; will-change: transform; }
.hl {
  margin: 0; padding: 10px 14px;
  font: inherit; white-space: pre; tab-size: 4;
  color: var(--fg);
}
.err-line {
  position: absolute; top: 0; left: 0; right: 0; height: var(--lh);
  background: var(--err-soft);
  border-left: 3px solid var(--err);
  pointer-events: none;
}
.editor textarea {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 10px 14px;
  border: 0; border-radius: 0; outline: none; resize: none;
  background: transparent; color: var(--fg); caret-color: var(--fg);
  font: inherit; white-space: pre; tab-size: 4;
  overflow: auto;
  -webkit-appearance: none; appearance: none;
}
.editor.hl-on textarea { color: transparent; -webkit-text-fill-color: transparent; }
.editor textarea::selection { background: var(--sel-text); }
.editor textarea::placeholder { color: var(--fg-subtle); -webkit-text-fill-color: var(--fg-subtle); opacity: 1; }

.t-k { color: var(--tok-key); }
.t-s { color: var(--tok-str); }
.t-n { color: var(--tok-num); }
.t-b { color: var(--tok-bool); }
.t-z { color: var(--tok-null); }
.t-p { color: var(--tok-punct); }

/* ---------- Status bar ---------- */
.status {
  flex: none;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 38px; padding: 6px 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--fg-muted);
}
.status svg.i { width: 16px; height: 16px; }
.status .sep { color: var(--border-strong); }
.status.ok svg.i { color: var(--ok); }
.status.ok strong { color: var(--ok); font-weight: 600; }
.status.err { background: var(--err-soft); color: var(--err); }
.status.err .err-text { flex: 1 1 200px; min-width: 0; }
.status.err .btn { border-color: transparent; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Tree ---------- */
.search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 2px;
  height: 32px; padding: 0 4px 0 9px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search > svg.i { width: 15px; height: 15px; color: var(--fg-subtle); }
.search input {
  flex: 1; min-width: 40px; height: 100%;
  border: 0; outline: 0; background: transparent; color: var(--fg);
  font: 13px var(--sans); padding: 0 6px;
}
.search input::-webkit-search-cancel-button { display: none; }
.search-count { font-size: 11.5px; color: var(--fg-subtle); white-space: nowrap; padding: 0 4px; font-variant-numeric: tabular-nums; }
.search .icon-btn { width: 26px; height: 26px; }
.search .icon-btn svg.i { width: 15px; height: 15px; }

.tree-wrap { flex: 1; min-height: 0; position: relative; }
.tree {
  position: absolute; inset: 0;
  overflow: auto; outline: none;
  padding: 6px 0 28px;
  font: 13px/22px var(--mono);
  overscroll-behavior: contain;
}
.tree > .node { width: max-content; min-width: 100%; }

.node > .children { display: none; }
.node.open > .children { display: block; }

.row {
  position: relative;
  display: flex; align-items: center;
  min-height: 24px;
  padding: 0 14px 0 calc(var(--d, 0) * var(--ind) + 6px);
  white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.row::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 6px;
  width: calc(var(--d, 0) * var(--ind));
  background: repeating-linear-gradient(90deg, transparent 0 8px, var(--guide) 8px 9px, transparent 9px var(--ind));
  pointer-events: none;
}
.row:hover { background: var(--hover); }
.row.match { background: var(--match-row); }
.row.match.cur { background: var(--match-cur); }
.row.sel { background: var(--sel); }
.tree:focus-visible .row.sel { box-shadow: inset 2px 0 0 var(--accent); }

.caret { width: 18px; height: 22px; flex: none; display: inline-grid; place-items: center; color: var(--fg-subtle); }
.branch > .row > .caret::before {
  content: ""; width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .12s ease;
}
.branch.open > .row > .caret::before { transform: rotate(90deg); }
.branch > .row:hover > .caret { color: var(--fg); }

.key { color: var(--tok-key); }
.key.idx { color: var(--fg-subtle); }
.key.root { color: var(--fg-muted); font-style: italic; }
.colon { color: var(--tok-punct); margin-right: 7px; }
.key.root + .colon { display: none; }
.key.root { margin-right: 8px; }
.v.str { color: var(--tok-str); }
.v.num { color: var(--tok-num); }
.v.bool { color: var(--tok-bool); }
.v.null { color: var(--tok-null); font-style: italic; }
.badge {
  display: inline-block; flex: none;
  font: 600 10.5px/17px var(--mono);
  padding: 0 5px; margin-right: 6px; border-radius: 4px;
  color: var(--fg-muted); background: var(--surface-2);
  border: 1px solid var(--border);
}
.count { color: var(--fg-subtle); font-size: 12px; }
.preview { color: var(--fg-subtle); margin-left: 10px; font-size: 12px; }
.branch.open > .row > .preview { display: none; }
.swatch {
  display: inline-block; width: 12px; height: 12px; flex: none;
  border-radius: 3px; margin-right: 6px;
  border: 1px solid var(--border-strong);
}
.more { padding: 4px 14px 6px calc(var(--d, 0) * var(--ind) + 24px); display: flex; align-items: center; gap: 8px; color: var(--fg-subtle); font: 12px var(--sans); }

::highlight(jv-search) { background-color: var(--match); color: inherit; }

/* Tree message overlay */
.tree-msg {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
  background: var(--surface);
}
.tree-msg.show { display: flex; }
.msg-card { max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.msg-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.msg-icon svg.i { width: 26px; height: 26px; }
.msg-icon.err { background: var(--err-soft); color: var(--err); }
.msg-card h2 { margin: 4px 0 0; font-size: 16px; }
.msg-card p { margin: 0; color: var(--fg-muted); font-size: 13.5px; }
.msg-card code { font: 12.5px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }

/* Details panel */
.details {
  flex: none; max-height: 42%;
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  overflow: auto;
}
.details-head { display: flex; align-items: center; gap: 4px; }
.details-path {
  flex: 1; min-width: 0;
  font: 12.5px/26px var(--mono);
  padding: 0 9px; height: 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  overflow-x: auto; overflow-y: hidden; white-space: nowrap;
  scrollbar-width: none;
}
.details-path::-webkit-scrollbar { display: none; }
.details-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--fg-muted); }
.type-chip { font: 600 11px/18px var(--mono); padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.details-value {
  margin: 0; padding: 8px 10px;
  font: 12.5px/1.55 var(--mono);
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  max-height: 180px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.details-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--fg);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(8, 10, 18, .5); backdrop-filter: blur(2px); }
.dlg-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg-body h2 { margin: 0; font-size: 17px; }
.dlg-body p { margin: 0; color: var(--fg-muted); font-size: 13px; }
.field {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--fg); font: 14px var(--sans);
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-error { color: var(--err) !important; }
.kbd-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.kbd-list dt { color: var(--fg-muted); }
.kbd-list dd { margin: 0; text-align: right; }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin-left: 2px;
  font: 600 11.5px/18px var(--mono); text-align: center;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
}

/* ---------- Toasts & drop overlay ---------- */
.toasts {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 50; pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  background: #1c2030; color: #f2f4f8;
  font-size: 13px; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast svg.i { width: 16px; height: 16px; }
.toast.ok svg.i { color: #4ade80; }
.toast.err svg.i { color: #ff8a8a; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.drop-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  background: rgba(79, 70, 229, .12);
  backdrop-filter: blur(3px);
}
.drop-overlay.show { display: flex; }
.drop-card {
  padding: 32px 44px; border-radius: 18px;
  border: 2px dashed var(--accent);
  background: var(--surface); color: var(--fg);
  font-size: 16px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
}
.drop-card svg.i { width: 32px; height: 32px; color: var(--accent); }

/* ---------- Content / SEO section ---------- */
.content { max-width: 920px; margin: 0 auto; padding: 48px 16px 24px; }
.content h2 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 10px; }
.content h3 { font-size: 16px; margin: 0 0 6px; }
.content p, .content li { color: var(--fg-muted); font-size: 15px; line-height: 1.65; }
.content .lead { font-size: 16px; margin: 0 0 28px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin: 0 0 40px; padding: 0; list-style: none; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.feature .f-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.feature p { margin: 0; font-size: 14px; }
.steps { padding-left: 20px; margin: 0 0 40px; }
.steps li { margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--fg-subtle); font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 16px max(22px, env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: center;
  color: var(--fg-subtle); font-size: 13px;
}
.site-footer a { color: var(--fg-muted); text-decoration: none; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }

/* ---------- Document pages (privacy etc.) ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.doc h1 { font-size: 28px; letter-spacing: -.02em; margin: 24px 0 8px; }
.doc h2 { font-size: 18px; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--fg-muted); line-height: 1.7; }
.doc .updated { color: var(--fg-subtle); font-size: 13px; }
.doc-top { display: flex; align-items: center; gap: 10px; }
.doc-top .brand h1, .doc-top .brand span { margin: 0; font-size: 16px; font-weight: 700; color: var(--fg); }

/* ---------- Responsive ---------- */
@media (min-width: 1280px) and (min-height: 820px) {
  .ad-rail { display: flex; }
}
@media (min-width: 1600px) and (min-height: 820px) {
  .ad-rail { width: 300px; }
  .ad-rail .ad-slot { width: 300px; height: 600px; }
}

@media (max-width: 1100px) {
  .btn .lbl-opt { display: none; }
}

@media (max-width: 899px) {
  .mobile-tabs { display: flex; }
  .splitter { display: none; }
  .layout { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .pane-text, .pane-tree { flex: 1 1 auto; }
  .workspace[data-view="text"] .pane-tree,
  .workspace[data-view="tree"] .pane-text { display: none; }
  .toolbar {
    padding: 8px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .toolbar::after { content: ""; flex: 0 0 20px; }
  .ad-top { padding: 6px 8px 0; }
  .details { max-height: 40%; padding: 8px 10px; gap: 5px; }
  .details-value { max-height: 84px; }
}

@media (max-width: 760px) {
  .ad-top .ad-slot { width: 320px; height: 50px; }
}

@media (max-width: 640px) {
  .topbar { padding-left: 12px; padding-right: 8px; gap: 8px; }
  .privacy-pill .pill-long { display: none; }
  .brand h1 small { display: none; }
  .tb-sep { margin: 0 1px; }
  .content h2 { font-size: 21px; }
}

@media (pointer: coarse) {
  .row { min-height: 32px; }
  .caret { width: 22px; }
  .btn { height: 36px; }
  .select { height: 36px; }
}

/* iOS Safari zooms into inputs with font-size < 16px. */
@supports (-webkit-touch-callout: none) {
  .editor { --lh: 23px; font-size: 16px; }
  .search input, .field { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
