:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #66716d;
  --soft: #edf1ed;
  --line: #dbe1dc;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --accent: #165a45;
  --accent-strong: #0f4434;
  --accent-soft: #dff2e9;
  --error: #a43b2c;
  --error-soft: #fff0ed;
  --warning: #8a5a13;
  --shadow: 0 20px 65px rgba(23, 32, 29, 0.08);
  --radius-lg: 22px;
  --radius-md: 14px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 3%, rgba(22, 90, 69, 0.08), transparent 24rem),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
select,
textarea,
input {
  font: inherit;
}

button,
select,
.file-action {
  touch-action: manipulation;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible,
.file-action:focus-visible {
  outline: 3px solid rgba(22, 90, 69, 0.24);
  outline-offset: 2px;
}

.site-header {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f9f74;
  box-shadow: 0 0 0 4px rgba(47, 159, 116, 0.12);
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
}

.tool-shell {
  padding: 28px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(219, 225, 220, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.tool-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.tool-intro {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfcfa;
}

.action-group,
.option-group,
.panel-actions,
.view-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button,
select,
.copy-button,
.view-button,
.text-action {
  min-height: 42px;
  border-radius: 10px;
  transition: 140ms ease;
}

.button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  border-color: #9ea9a3;
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.button-primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.select-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
}

.check-label {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.check-label input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
}

.status-icon {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab2ae;
}

.status[data-kind="success"] {
  color: var(--accent-strong);
  border-color: #bcdaca;
  background: var(--accent-soft);
}

.status[data-kind="success"] .status-icon {
  background: #21825e;
}

.status[data-kind="error"] {
  color: var(--error);
  border-color: #efc6be;
  background: var(--error-soft);
}

.status[data-kind="error"] .status-icon {
  background: var(--error);
}

.error-detail {
  margin: -1px 0 12px;
  padding: 13px;
  border: 1px solid #efc6be;
  border-radius: 11px;
  background: #fff9f7;
}

.error-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 9px;
  color: var(--error);
  font-size: 13px;
}

.error-heading span {
  color: #704a43;
}

.error-detail pre {
  max-width: 100%;
  margin: 0;
  overflow: auto;
  color: #542d26;
  font: 12px/1.55 var(--mono);
  white-space: pre;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.editor-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.panel-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin-bottom: 1px;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.panel-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.text-action,
.copy-button,
.view-button {
  border: 0;
  cursor: pointer;
}

.text-action {
  min-height: 36px;
  padding: 8px 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.text-action:hover {
  color: var(--ink);
  background: var(--soft);
}

.file-action {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.copy-button {
  min-height: 36px;
  padding: 8px 13px;
  color: white;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.copy-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.view-switch {
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--soft);
}

.view-button {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.view-button.is-active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(23, 32, 29, 0.12);
}

textarea {
  display: block;
  width: 100%;
  height: clamp(330px, 47vh, 610px);
  resize: vertical;
  padding: 17px;
  border: 0;
  outline: 0;
  color: #1d2824;
  background: #fff;
  font: 13px/1.6 var(--mono);
  tab-size: 2;
}

textarea::placeholder {
  color: #9aa39f;
}

#jsonOutput {
  background: #fbfcfa;
}

.tree-output {
  width: 100%;
  height: clamp(330px, 47vh, 610px);
  padding: 17px;
  overflow: auto;
  background: #fbfcfa;
  font: 13px/1.65 var(--mono);
}

.tree-node {
  margin-left: 17px;
}

.tree-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: max-content;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tree-key {
  color: #724aa6;
}

.tree-string {
  color: #0b6a4c;
}

.tree-number {
  color: #a05118;
}

.tree-boolean {
  color: #1766a3;
}

.tree-null {
  color: #7b8581;
  font-style: italic;
}

.tree-summary {
  color: var(--muted);
}

.content-section {
  max-width: 1120px;
  margin: 110px auto 0;
}

.section-heading {
  max-width: 650px;
  margin-bottom: 34px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.section-lede {
  max-width: 72ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
}

code {
  padding: 0.12em 0.34em;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #293631;
  background: rgba(255, 255, 255, 0.7);
  font: 0.88em/1.45 var(--mono);
  overflow-wrap: anywhere;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.feature-grid article {
  min-height: 220px;
  padding: 26px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.feature-number {
  display: block;
  margin-bottom: 38px;
  color: var(--accent);
  font: 12px var(--mono);
}

.feature-grid h3 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.feature-grid p {
  max-width: 46ch;
  margin-bottom: 0;
  color: var(--muted);
}

.edge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.edge-grid article {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.edge-grid h3 {
  margin-bottom: 10px;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.edge-grid p {
  color: var(--muted);
}

.edge-grid a {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 750;
  text-underline-offset: 3px;
}

.edge-label {
  margin-bottom: 12px;
  color: var(--accent) !important;
  font: 800 11px/1.2 var(--mono);
  letter-spacing: 0.12em;
}

.edge-checklist {
  background: var(--accent-soft) !important;
  border-color: #bfdacb !important;
}

.evidence-note {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.steps li {
  counter-increment: steps;
  padding: 22px 0;
  border-top: 1px solid var(--ink);
  color: var(--muted);
}

.steps li::before {
  content: "0" counter(steps);
  display: block;
  margin-bottom: 28px;
  color: var(--accent);
  font: 12px var(--mono);
}

.faq-list {
  border-top: 1px solid var(--line);
}

details {
  border-bottom: 1px solid var(--line);
}

summary {
  padding: 20px 42px 20px 0;
  position: relative;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 8px;
  color: var(--accent);
  font: 22px var(--mono);
}

details[open] summary::after {
  content: "−";
}

details p {
  max-width: 750px;
  margin-bottom: 22px;
  color: var(--muted);
}

footer {
  width: min(1120px, calc(100% - 40px));
  margin: 110px auto 0;
  padding: 28px 0 34px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .tool-shell {
    padding: 18px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  textarea,
  .tree-output {
    height: 390px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1440px);
  }

  .site-header {
    min-height: 60px;
  }

  .privacy-note {
    font-size: 0;
  }

  .privacy-note::after {
    content: "Private";
    font-size: 12px;
  }

  .tool-shell {
    padding: 14px;
    border-radius: 16px;
  }

  .tool-heading {
    display: block;
    margin-bottom: 18px;
  }

  .tool-intro {
    margin: 9px 0 0;
  }

  .toolbar,
  .action-group,
  .option-group {
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .action-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .button {
    padding-inline: 8px;
  }

  .option-group {
    justify-content: space-between;
    padding-top: 3px;
    border-top: 1px solid var(--line);
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions {
    width: 100%;
    justify-content: flex-end;
    overflow-x: auto;
  }

  textarea,
  .tree-output {
    height: 320px;
    min-height: 260px;
    padding: 14px;
    font-size: 12px;
  }

  .content-section {
    margin-top: 78px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .edge-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid article {
    min-height: 190px;
  }

  footer {
    margin-top: 76px;
    flex-direction: column;
  }
}

@media (max-width: 350px) {
  .toolbar {
    padding: 8px;
  }

  .action-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .button {
    min-width: 0;
    font-size: 13px;
  }

  .option-group {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 8px;
  }

  .option-group select {
    width: 100%;
    min-width: 0;
  }

  .option-group .check-label {
    grid-column: 1 / -1;
    min-height: 34px;
    padding-inline: 0;
  }
}

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