:root {
  --ink: #17140f;
  --muted: #766d5e;
  --paper: #f6f0df;
  --paper-deep: #eadfc2;
  --charcoal: #20201c;
  --clay: #c65f3d;
  --moss: #60724d;
  --amber: #e8b550;
  --line: rgba(32, 32, 28, 0.16);
  --shadow: 0 24px 80px rgba(44, 31, 18, 0.18);
  --mono: "IBM Plex Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --display: Georgia, "Times New Roman", serif;
  --body: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 12% 18%, rgba(232, 181, 80, 0.34), transparent 30rem),
    radial-gradient(circle at 88% 8%, rgba(96, 114, 77, 0.22), transparent 28rem),
    linear-gradient(135deg, #fbf4e2 0%, #eee1c2 48%, #efe8d4 100%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    linear-gradient(90deg, rgba(23, 20, 15, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(23, 20, 15, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

.compact-hero {
  padding: 16px clamp(16px, 3vw, 40px) 8px;
}

.topbar,
.workbench,
.seo-content,
.footer {
  width: min(1440px, calc(100vw - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(246, 240, 223, 0.72);
  backdrop-filter: blur(20px);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy small {
  color: var(--moss);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 16px;
  color: #fff7e8;
  background: var(--charcoal);
  font-family: var(--mono);
}

.nav-links {
  color: var(--muted);
  font-size: 14px;
}

.ghost-button,
.toolbar button,
.panel-head button,
.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.secondary-button.compact {
  min-height: 38px;
  padding-inline: 14px;
  white-space: nowrap;
}

.ghost-button,
.toolbar button,
.panel-head button {
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid var(--line);
}

.language-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 168px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(32, 32, 28, 0.18);
  border-radius: 999px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 251, 241, 0.92), rgba(239, 229, 203, 0.78)),
    var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(44, 31, 18, 0.1);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.language-picker::after {
  content: "";
  position: absolute;
  top: 15px;
  right: 16px;
  width: 8px;
  height: 8px;
  pointer-events: none;
  border-right: 2px solid var(--moss);
  border-bottom: 2px solid var(--moss);
  transform: rotate(45deg);
}

.language-picker:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 14px 30px rgba(44, 31, 18, 0.13);
}

.language-picker:focus-within {
  border-color: rgba(232, 181, 80, 0.95);
  box-shadow:
    0 0 0 4px rgba(232, 181, 80, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 14px 30px rgba(44, 31, 18, 0.14);
}

.language-caption {
  padding-left: 14px;
  color: var(--moss);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.language-select {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 38px 0 8px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
  appearance: none;
}

.language-select::-ms-expand {
  display: none;
}

.language-select option {
  color: var(--ink);
  background: #fbf4e2;
}

button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--clay);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.055em;
}

h1 {
  max-width: 880px;
  font-size: clamp(48px, 8vw, 110px);
  line-height: 0.89;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 800;
}

.primary-button {
  color: #fff8eb;
  background: var(--charcoal);
  box-shadow: 0 14px 34px rgba(23, 20, 15, 0.26);
}

.secondary-button {
  color: var(--ink);
  background: var(--amber);
}

.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9be36d;
  box-shadow: 0 0 0 12px rgba(155, 227, 109, 0.12);
}

.workbench {
  margin-top: 8px;
}

.workbench {
  padding: clamp(12px, 1.4vw, 18px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 248, 231, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.seo-content {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr);
  gap: clamp(20px, 4vw, 58px);
  padding: clamp(34px, 6vw, 72px) 8px 10px;
}

.seo-content h2 {
  max-width: 720px;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 1;
}

.seo-content p {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.feature-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.feature-list div {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.feature-list dt {
  color: var(--ink);
  font-weight: 900;
}

.feature-list dd {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.toolbar .danger {
  color: #fff8eb;
  background: var(--clay);
}

.toolbar .sample-action {
  background: var(--amber);
  font-weight: 800;
}

.editor-head {
  justify-content: flex-start;
}

.editor-head .status-pill {
  margin-left: auto;
}

.console-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  align-items: stretch;
}

.handoff-panel {
  grid-column: 1 / -1;
}

.handoff-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 10px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 252, 241, 0.78);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.split-head {
  align-items: center;
}

.split-head input {
  max-width: min(190px, 55%);
}

.status-pill {
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff8eb;
  background: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.status-pill.ok {
  background: var(--moss);
}

.status-pill.bad {
  background: var(--clay);
}

textarea,
.line-input,
.panel-head input,
.panel-head select {
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line);
  outline: 0;
  background: rgba(255, 255, 255, 0.54);
}

#jsonInput {
  position: relative;
  z-index: 1;
  min-height: 520px;
  max-height: 520px;
  resize: vertical;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: #fff2d6;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.58;
}

#jsonInput::selection {
  color: #fff2d6;
  background: rgba(232, 181, 80, 0.36);
}

.json-editor-wrap {
  position: relative;
  background: #17140f;
}

.json-highlight {
  position: absolute;
  inset: 0;
  min-height: 520px;
  max-height: 520px;
  margin: 0;
  padding: 14px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  color: #fff2d6;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.58;
  pointer-events: none;
}

.json-highlight mark {
  border-radius: 4px;
  color: #17140f;
  background: #e8b550;
  box-shadow: 0 0 0 2px rgba(232, 181, 80, 0.24);
}

.json-highlight.is-locating mark {
  animation: locatePulse 900ms ease-out;
}

.mini-editor {
  min-height: 128px;
  resize: vertical;
  padding: 14px;
  border-width: 0 0 1px;
  border-radius: 0;
  font-family: var(--mono);
}

.line-input,
.panel-head input,
.panel-head select {
  border-radius: 999px;
  padding: 10px 12px;
}

.error-box {
  min-height: 36px;
  padding: 8px 10px;
  color: var(--clay);
  font-family: var(--mono);
  font-size: 12px;
  transition: color 160ms ease, background 160ms ease;
}

.error-box.is-toast {
  color: var(--moss);
  background: rgba(96, 114, 77, 0.1);
}

.tree-output,
.code-output {
  min-height: 556px;
  max-height: 556px;
  overflow: auto;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.tree-output {
  background: rgba(255, 255, 255, 0.24);
}

.tree-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(32, 32, 28, 0.08);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.tree-row:hover,
.tree-row:focus-visible {
  background: rgba(232, 181, 80, 0.16);
  outline: none;
  transform: translateX(2px);
}

.tree-row mark {
  border-radius: 4px;
  background: rgba(232, 181, 80, 0.52);
}

.copy-path {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  font-family: var(--mono);
  font-size: 11px;
}

.copy-path:hover {
  color: var(--ink);
  background: var(--amber);
}

.code-output {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #201f1b;
  color: #f9edcf;
}

.handoff-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
}

.handoff-grid div {
  min-height: 70px;
  padding: 12px;
  border-radius: 14px;
  color: #f8ecd0;
  background: var(--charcoal);
}

.handoff-grid small {
  display: block;
  color: rgba(248, 236, 208, 0.62);
  font-family: var(--mono);
  text-transform: uppercase;
}

.handoff-grid strong {
  display: block;
  margin-top: 7px;
  font-family: var(--display);
  font-size: 26px;
}

.handoff-list {
  min-width: 0;
  padding: 0;
}

.handoff-list p {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 800;
}

.path-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 72px;
  overflow: auto;
}

.path-chip-list button {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  font-family: var(--mono);
  font-size: 11px;
}

.report-output {
  min-height: 120px;
  max-height: 120px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  white-space: pre-wrap;
  color: #f9edcf;
  background: #201f1b;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 40px;
  color: var(--muted);
}

.toast {
  position: fixed;
  top: 92px;
  left: 50%;
  z-index: 20;
  padding: 9px 12px;
  border: 1px solid rgba(232, 181, 80, 0.46);
  border-radius: 14px;
  color: #17140f;
  background:
    linear-gradient(180deg, rgba(255, 248, 231, 0.98), rgba(232, 181, 80, 0.92));
  box-shadow: 0 14px 34px rgba(23, 20, 15, 0.24);
  font-weight: 900;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -10px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border-right: 1px solid rgba(232, 181, 80, 0.46);
  border-bottom: 1px solid rgba(232, 181, 80, 0.46);
  background: rgba(232, 181, 80, 0.92);
  transform: translateX(-50%) rotate(45deg);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1) !important;
}

.reveal {
  animation: rise 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.delay-1 {
  animation-delay: 110ms;
}

.delay-2 {
  animation-delay: 220ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes locatePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(232, 181, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(232, 181, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(232, 181, 80, 0);
  }
}

@media (max-width: 900px) {
  .nav-links a {
    display: none;
  }

  .seo-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .console-grid,
  .handoff-row {
    grid-template-columns: 1fr;
  }

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

  #jsonInput {
    min-height: 420px;
    max-height: none;
  }

  .tree-output,
  .code-output {
    min-height: 360px;
    max-height: 460px;
  }
}
