:root {
  --bg: #08111f;
  --bg-soft: #0d192a;
  --panel: rgba(15, 29, 47, .88);
  --panel-strong: #12233a;
  --panel-hover: #172c46;
  --line: rgba(152, 186, 219, .16);
  --line-strong: rgba(152, 186, 219, .27);
  --text: #edf5ff;
  --muted: #8ea5be;
  --faint: #5f7791;
  --accent: #6df4c5;
  --accent-2: #8ab4ff;
  --danger: #ff8297;
  --warning: #ffd98a;
  --shadow: 0 24px 70px rgba(0, 0, 0, .25);
  --radius: 18px;
}

[data-theme='light'] {
  --bg: #edf3f8;
  --bg-soft: #e5edf4;
  --panel: rgba(255, 255, 255, .9);
  --panel-strong: #fff;
  --panel-hover: #f3f8fc;
  --line: rgba(31, 61, 88, .14);
  --line-strong: rgba(31, 61, 88, .24);
  --text: #102338;
  --muted: #5c7188;
  --faint: #7e93a7;
  --shadow: 0 24px 70px rgba(35, 67, 95, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  transition: background .25s ease, color .25s ease;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background-image: linear-gradient(rgba(116, 159, 203, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(116, 159, 203, .045) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(109, 244, 197, .48);
  border-radius: 11px;
  color: var(--accent);
  background: rgba(109, 244, 197, .08);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  box-shadow: 0 0 28px rgba(109, 244, 197, .09);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand small { margin-top: 1px; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .11em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.local-pill, .conversion-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .04em;
}
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(109, 244, 197, .12), 0 0 12px var(--accent); }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; transition: .2s ease; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel); }

.page-shell { position: relative; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 30px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .45fr); gap: 54px; align-items: end; padding: 24px 0 54px; }
.eyebrow { color: var(--accent); font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: .17em; }
h1, h2 { margin: 0; letter-spacing: -.055em; line-height: .98; }
h1 { margin-top: 14px; font-size: clamp(48px, 8vw, 93px); font-weight: 600; }
h1 span { color: var(--accent-2); }
.hero-side { padding-bottom: 7px; }
.hero-copy { max-width: 420px; margin: 0 0 30px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-stats { display: flex; justify-content: flex-start; gap: 26px; padding-bottom: 4px; }
.hero-stats div { min-width: 76px; }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { color: var(--text); font-family: 'DM Mono', monospace; font-size: 24px; font-weight: 500; }
.hero-stats span { margin-top: 5px; color: var(--faint); font-size: 11px; }

.privacy-banner { display: flex; align-items: center; gap: 15px; margin-bottom: 38px; padding: 16px 19px; border: 1px solid rgba(109, 244, 197, .2); border-radius: var(--radius); background: linear-gradient(100deg, rgba(109, 244, 197, .09), rgba(138, 180, 255, .05)); }
.privacy-icon { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--accent); background: rgba(109, 244, 197, .12); font-size: 23px; }
.privacy-banner strong { display: block; font-size: 13px; }
.privacy-banner p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.privacy-tag { margin-left: auto; color: var(--accent); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; white-space: nowrap; }

.tool-tabs { display: flex; gap: 5px; margin-bottom: 15px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(8, 17, 31, .2); overflow-x: auto; }
.tool-tab { display: inline-flex; align-items: center; gap: 9px; min-height: 39px; padding: 0 15px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; white-space: nowrap; transition: .2s ease; }
.tool-tab span { color: var(--faint); font-family: 'DM Mono', monospace; font-size: 10px; }
.tool-tab:hover { color: var(--text); background: var(--panel); }
.tool-tab.active { color: var(--text); background: var(--panel-strong); box-shadow: 0 4px 16px rgba(0, 0, 0, .13); }
.tool-tab.active span { color: var(--accent); }

.tool-section { display: none; padding: 31px 32px 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); animation: rise .28s ease both; }
.tool-section.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
h2 { margin-top: 10px; font-size: clamp(28px, 4vw, 42px); font-weight: 500; }
.ghost-button { display: inline-flex; align-items: center; gap: 8px; min-height: 35px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--muted); background: transparent; font-size: 11px; transition: .2s ease; }
.ghost-button span { color: var(--accent); }
.ghost-button:hover { color: var(--text); border-color: var(--accent); background: rgba(109, 244, 197, .06); }

.sub-tabs { display: flex; gap: 3px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.sub-tab { position: relative; padding: 0 13px 11px; border: 0; color: var(--muted); background: transparent; font-family: 'DM Mono', monospace; font-size: 11px; white-space: nowrap; }
.sub-tab::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; content: ''; background: transparent; }
.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--accent); }
.sub-tab.active::after { background: var(--accent); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.editor-card, .result-card, .path-result-card, .diff-result-card, .tree-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 11, 21, .26); overflow: hidden; }
[data-theme='light'] .editor-card, [data-theme='light'] .result-card, [data-theme='light'] .path-result-card, [data-theme='light'] .diff-result-card, [data-theme='light'] .tree-card { background: rgba(255, 255, 255, .62); }
.card-topline { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.card-topline label, .card-topline > span, .card-topline > div > span:first-child { color: var(--text); font-family: 'DM Mono', monospace; font-size: 11px; }
.muted-label { color: var(--faint) !important; font-family: 'DM Mono', monospace; font-size: 10px !important; }
textarea, input, select { color: var(--text); border: 0; outline: 0; background: transparent; }
textarea { display: block; width: 100%; min-height: 320px; resize: vertical; padding: 17px; font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.75; tab-size: 2; }
textarea::placeholder, input::placeholder { color: var(--faint); }
.output-area { color: #b9d6f1; }
[data-theme='light'] .output-area { color: #294c6c; }
.editor-footer, .result-footer { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px; border-top: 1px solid var(--line); }
.text-button { padding: 4px 2px; border: 0; color: var(--muted); background: none; font-size: 11px; }
.text-button:hover { color: var(--accent); }
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.small-button, .secondary-button { min-height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--muted); background: transparent; font-family: 'DM Mono', monospace; font-size: 10px; transition: .2s ease; }
.small-button:hover, .secondary-button:hover { color: var(--text); border-color: var(--accent); background: rgba(109, 244, 197, .06); }
.small-button.subtle { border-color: transparent; }
.inline-message { min-height: 16px; color: var(--accent); font-size: 10px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; margin-left: 9px; color: var(--muted) !important; font-family: 'Space Grotesk', sans-serif !important; font-size: 10px !important; }
.status-dot::before { width: 6px; height: 6px; border-radius: 50%; content: ''; background: var(--faint); }
.status-dot.valid { color: var(--accent) !important; }
.status-dot.valid::before { background: var(--accent); box-shadow: 0 0 8px rgba(109, 244, 197, .7); }
.status-dot.invalid { color: var(--danger) !important; }
.status-dot.invalid::before { background: var(--danger); }

.hidden { display: none !important; }
.tree-workspace { margin-top: 18px; }
.tree-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tree-toolbar label { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; }
.tree-toolbar input { width: min(270px, 42%); min-height: 31px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 11px; }
.tree-toolbar input:focus, .path-input-row input:focus, .converter-controls select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 244, 197, .1); }
.tree-card { min-height: 270px; padding: 14px 17px 18px; }
.tree-result-footer { margin-top: 8px; padding-right: 2px; padding-left: 2px; }
.empty-state { display: grid; min-height: 140px; place-items: center; color: var(--faint); font-family: 'DM Mono', monospace; font-size: 11px; text-align: center; }
.tree-list { margin: 0; padding: 0; list-style: none; }
.tree-node { position: relative; margin: 2px 0; }
.tree-row { display: flex; align-items: center; min-height: 29px; gap: 6px; border-radius: 6px; font-family: 'DM Mono', monospace; font-size: 11px; }
.tree-row:hover { background: rgba(138, 180, 255, .07); }
.tree-toggle { width: 20px; padding: 0; border: 0; color: var(--accent); background: none; font-size: 12px; }
.tree-key { color: var(--accent-2); }
.tree-value { color: #d6e7f8; }
[data-theme='light'] .tree-value { color: #355674; }
.tree-type-string { color: #f1c785; }
.tree-type-number { color: #b69cff; }
.tree-type-boolean { color: #72dbe1; }
.tree-type-null { color: var(--faint); }
.tree-children { margin-left: 17px; padding-left: 10px; border-left: 1px dashed var(--line-strong); }
.tree-node.collapsed > .tree-children { display: none; }
.tree-copy { margin-left: auto; padding: 2px 5px; border: 0; color: var(--faint); background: none; font-size: 10px; opacity: 0; }
.tree-row:hover .tree-copy, .tree-copy:focus { opacity: 1; }
.tree-copy:hover { color: var(--accent); }
.tree-match { background: rgba(255, 217, 138, .18) !important; }

.path-input-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.path-input-row label { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 11px; }
.path-input-row input { flex: 1; min-height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; font-family: 'DM Mono', monospace; font-size: 12px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 38px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 9px; color: #062218; background: var(--accent); font-size: 11px; font-weight: 600; transition: .2s ease; }
.primary-button.compact { min-height: 28px; padding: 0 11px; gap: 7px; font-size: 10px; }
.primary-button span { font-size: 16px; line-height: 0; }
.primary-button:hover { background: #a3ffdc; box-shadow: 0 8px 24px rgba(109, 244, 197, .18); transform: translateY(-1px); }
.code-output { min-height: 180px; margin: 0; padding: 18px; color: #b9d6f1; font-family: 'DM Mono', monospace; font-size: 12px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
[data-theme='light'] .code-output { color: #294c6c; }

.diff-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.diff-inputs textarea { min-height: 230px; }
.diff-toolbar { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.diff-result-card { overflow: hidden; }
.diff-result { min-height: 150px; padding: 6px 14px 13px; }
.diff-table { width: 100%; border-collapse: collapse; font-family: 'DM Mono', monospace; font-size: 11px; }
.diff-table th, .diff-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.diff-table th { color: var(--faint); font-size: 10px; font-weight: 400; }
.diff-path { color: var(--accent-2); word-break: break-word; }
.diff-before { color: var(--danger); }
.diff-after { color: var(--accent); }
.diff-kind { display: inline-flex; padding: 3px 6px; border-radius: 4px; font-size: 9px; letter-spacing: .03em; }
.diff-kind.modified { color: var(--warning); background: rgba(255, 217, 138, .11); }
.diff-kind.added { color: var(--accent); background: rgba(109, 244, 197, .11); }
.diff-kind.removed { color: var(--danger); background: rgba(255, 130, 151, .11); }

.format-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -3px 0 18px; }
.format-hint { color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; gap: 7px; }
.converter-controls { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; }
.converter-controls label { display: flex; flex: 1; flex-direction: column; gap: 6px; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; }
.converter-controls select { width: 100%; min-height: 39px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--panel-strong); font-family: 'DM Mono', monospace; font-size: 11px; }
.swap-button { width: 39px; height: 39px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--accent); background: transparent; font-size: 18px; }
.swap-button:hover { border-color: var(--accent); background: rgba(109, 244, 197, .08); }

.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: min(360px, calc(100vw - 40px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--panel-strong); box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 130, 151, .55); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 3px 8px; color: var(--faint); font-family: 'DM Mono', monospace; font-size: 10px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 760px) {
  .site-header { padding: 12px 18px; }
  .local-pill { display: none; }
  .page-shell { width: min(100% - 24px, 600px); padding-top: 36px; }
  .hero { display: block; padding-bottom: 36px; }
  .hero-side { padding-bottom: 0; }
  .hero-copy { margin-top: 23px; margin-bottom: 24px; }
  .hero-stats { justify-content: flex-start; gap: 25px; margin-top: 27px; }
  .privacy-banner { align-items: flex-start; }
  .privacy-tag { display: none; }
  .tool-section { padding: 23px 14px 24px; border-radius: 17px; }
  .section-heading { align-items: flex-start; margin-bottom: 20px; }
  .section-heading .ghost-button { margin-top: 10px; }
  .workspace-grid, .diff-inputs { grid-template-columns: 1fr; }
  textarea { min-height: 230px; }
  .tree-toolbar { flex-wrap: wrap; }
  .tree-toolbar input { width: 100%; order: 2; }
  .path-input-row { align-items: stretch; flex-wrap: wrap; }
  .path-input-row input { flex-basis: calc(100% - 70px); }
  .path-input-row .primary-button { width: 100%; }
  .format-toolbar { align-items: flex-start; flex-direction: column; }
  .converter-controls { align-items: stretch; flex-wrap: wrap; }
  .converter-controls label { flex: 1 1 40%; }
  .swap-button { align-self: end; }
  .converter-controls .primary-button { width: 100%; }
  .site-footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
