:root {
  --bg: #09080a;
  --bg-deep: #050506;
  --surface: rgba(15, 13, 14, 0.84);
  --surface-soft: rgba(18, 17, 18, 0.76);
  --surface-strong: rgba(22, 19, 20, 0.94);
  --line: rgba(244, 210, 175, 0.14);
  --line-strong: rgba(255, 214, 167, 0.42);
  --text: #f6f1eb;
  --text-soft: rgba(240, 228, 216, 0.84);
  --text-muted: rgba(224, 205, 188, 0.62);
  --accent: #ffb97a;
  --accent-strong: #ff9a42;
  --accent-soft: rgba(255, 154, 66, 0.14);
  --blue: #f5cda2;
  --blue-soft: rgba(255, 197, 133, 0.16);
  --warn: #f6ad55;
  --warn-soft: rgba(246, 173, 85, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --shadow: 0 26px 56px rgba(0, 0, 0, 0.42);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  --font-heading: "Sora", "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 154, 66, 0.3), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(255, 205, 150, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.46), transparent 44%),
    linear-gradient(145deg, #7a3f1c 0%, #5b2d16 32%, #29160d 56%, #111111 80%, #060606 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button,
label {
  cursor: pointer;
}

a {
  color: inherit;
}

code,
pre {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.page_shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 96px 0 42px;
}

.hero,
.panel,
.segment_panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(162deg, rgba(18, 15, 15, 0.78), rgba(8, 8, 9, 0.92)),
    radial-gradient(circle at 88% 0%, rgba(248, 165, 86, 0.12), transparent 42%),
    radial-gradient(circle at 12% 110%, rgba(255, 255, 255, 0.04), transparent 38%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero::before,
.panel::before,
.segment_panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 233, 204, 0.06), transparent 22%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 76px);
}

.hero > *,
.panel > *,
.segment_panel > * {
  position: relative;
  z-index: 1;
}

.hero {
  padding: 24px clamp(18px, 3vw, 34px) clamp(26px, 4vw, 40px);
}

.tool_btn,
.segment_btn,
.node_action_btn,
.add_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 232, 203, 0.1), transparent 56%),
    linear-gradient(150deg, rgba(34, 26, 20, 0.94), rgba(16, 15, 18, 0.9));
  color: var(--text);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.tool_btn:hover,
.tool_btn:focus-visible,
.segment_btn:hover,
.segment_btn:focus-visible,
.node_action_btn:hover,
.node_action_btn:focus-visible,
.add_btn:hover,
.add_btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow:
    0 14px 22px rgba(0, 0, 0, 0.22),
    0 0 18px rgba(255, 154, 66, 0.12);
}

.hero_grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.78fr);
  gap: 26px;
  align-items: center;
}

.hero_badge,
.panel_eyebrow,
.hero_note_eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffbf86;
}

.hero_badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 154, 66, 0.1);
  border: 1px solid rgba(255, 196, 136, 0.18);
}

.hero h1 {
  margin: 10px 0 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(2rem, 3.8vw, 3.55rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero_text {
  max-width: 66ch;
  margin: 16px 0 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 1vw + 0.82rem, 1.08rem);
}

.hero_pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero_pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 136, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
  font-size: 0.92rem;
}

.hero_note {
  padding: 18px 20px;
  border: 1px solid rgba(255, 196, 136, 0.16);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 154, 66, 0.1), rgba(255, 154, 66, 0.03)),
    rgba(14, 12, 12, 0.74);
}

.hero_note h2 {
  margin: 8px 0 0;
  font-family: "Sora", sans-serif;
  font-size: 1.18rem;
}

.hero_steps {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--text-soft);
}

.hero_steps li + li {
  margin-top: 10px;
}

.app_shell {
  margin-top: 22px;
}

.segment_panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.segment_control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment_btn {
  min-width: 160px;
}

.segment_btn.is-active {
  border-color: rgba(255, 196, 136, 0.3);
  background: rgba(255, 154, 66, 0.16);
  color: var(--text);
}

.segment_hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: right;
}

.tool_section {
  margin-top: 18px;
}

.tool_grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 18px;
}

.panel_head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
}

.panel_head h2 {
  margin: 6px 0 0;
  font-family: "Sora", sans-serif;
  font-size: 1.34rem;
  line-height: 1.16;
}

.panel_hint {
  max-width: 34ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: right;
}

.panel_body {
  display: grid;
  gap: 16px;
  padding: 0 22px 22px;
}

.viewer_body {
  gap: 18px;
}

.field_group {
  display: grid;
  gap: 8px;
}

.compact_field {
  min-width: 180px;
}

.field_label {
  font-weight: 700;
  color: var(--text);
}

.field_hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

textarea,
input[type="text"],
input[type="search"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 12, 14, 0.92);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 280px;
}

#viewerInput,
#builderOutput,
#viewerFormattedOutput {
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.action_row,
.mini_actions,
.builder_toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action_row_spread {
  justify-content: space-between;
  align-items: center;
}

.tool_btn_soft {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

.tool_btn:disabled,
.node_action_btn:disabled,
.add_btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.viewer_upload_stage {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.dropzone_stage,
.viewer_quickstart_card,
.viewer_editor_card,
.viewer_tool_card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(164deg, rgba(14, 13, 14, 0.9), rgba(9, 9, 10, 0.94)),
    radial-gradient(circle at 88% 0%, rgba(248, 165, 86, 0.1), transparent 42%);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 233, 204, 0.05);
}

.dropzone_stage {
  display: grid;
  align-items: stretch;
  min-height: 270px;
  padding: clamp(20px, 3vw, 28px);
  border-style: dashed;
  border-width: 1.5px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.dropzone_stage:hover,
.dropzone_stage:focus-visible,
.dropzone_stage.is-dragover {
  transform: translateY(-1px);
  border-color: rgba(255, 214, 167, 0.8);
  box-shadow:
    0 22px 36px rgba(0, 0, 0, 0.34),
    0 0 20px rgba(246, 167, 90, 0.18),
    inset 0 1px 0 rgba(255, 233, 204, 0.1);
}

.dropzone_stage_content {
  display: grid;
  align-content: center;
  gap: 14px;
  max-width: 34rem;
}

.dropzone_eyebrow {
  margin: 0;
  color: #ffbf86;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dropzone_title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.4rem, 2vw, 1.95rem);
  line-height: 1.08;
}

.dropzone_text {
  margin: 0;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.55;
}

.dropzone_actions,
.viewer_quickstart_actions,
.viewer_editor_actions,
.viewer_tool_actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dropzone_pick_btn {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 232, 203, 0.18), transparent 56%),
    linear-gradient(150deg, rgba(44, 29, 21, 0.96), rgba(17, 17, 18, 0.92));
  border-color: rgba(252, 193, 129, 0.82);
  color: #fff1d8;
}

.dropzone_meta {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.viewer_quickstart_card,
.viewer_editor_card,
.viewer_tool_card {
  padding: 18px;
}

.viewer_quickstart_card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.viewer_quickstart_list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-soft);
}

.viewer_quickstart_list li + li {
  margin-top: 10px;
}

.viewer_editor_card {
  display: grid;
  gap: 14px;
}

.viewer_code_field {
  gap: 0;
}

.viewer_editor_head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.viewer_code_shell {
  position: relative;
  min-height: 520px;
  border: 1px solid rgba(255, 196, 136, 0.12);
  border-radius: 20px;
  overflow: hidden;
  background: #020912;
  box-shadow: inset 0 1px 0 rgba(255, 233, 204, 0.04);
}

.viewer_code_input,
.code_output_editor {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre;
  word-break: normal;
  line-height: 1.62;
  tab-size: 2;
}

.code_output_editor {
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}

.viewer_code_input {
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  resize: none;
}

.viewer_code_input::placeholder {
  color: rgba(240, 228, 216, 0.4);
  -webkit-text-fill-color: rgba(240, 228, 216, 0.4);
}

.viewer_code_input::selection {
  background: rgba(255, 154, 66, 0.24);
}

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

.viewer_tool_card {
  display: grid;
  gap: 10px;
}

.message_card,
.path_card,
.tree_card,
.code_card,
.builder_editor_panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--surface-soft);
}

.message_card {
  min-height: 52px;
  padding: 14px 16px;
  color: var(--text-soft);
}

.message_card.is-success {
  border-color: rgba(104, 201, 142, 0.24);
  background: rgba(104, 201, 142, 0.12);
  color: #d6ffe3;
}

.message_card.is-warning {
  border-color: rgba(246, 173, 85, 0.22);
  background: rgba(246, 173, 85, 0.12);
  color: #ffddb0;
}

.message_card.is-error {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(248, 113, 113, 0.12);
  color: #ffd0d0;
}

.stats_row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat_card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 12, 14, 0.76);
}

.stat_label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.stat_card strong {
  font-family: "Sora", sans-serif;
  font-size: 1.14rem;
}

.path_card,
.tree_card,
.code_card,
.builder_editor_panel {
  padding: 16px;
}

.path_head,
.code_head,
.builder_editor_head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.path_output,
.code_output {
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid rgba(255, 196, 136, 0.1);
  border-radius: 16px;
  background: rgba(7, 7, 9, 0.9);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.code_output {
  min-height: 220px;
  overflow: auto;
}

.viewer_code_input,
.code_output,
.path_output,
.tree_view {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 196, 136, 0.54) rgba(255, 255, 255, 0.04);
}

.viewer_code_input::-webkit-scrollbar,
.code_output::-webkit-scrollbar,
.path_output::-webkit-scrollbar,
.tree_view::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.viewer_code_input::-webkit-scrollbar-track,
.code_output::-webkit-scrollbar-track,
.path_output::-webkit-scrollbar-track,
.tree_view::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.viewer_code_input::-webkit-scrollbar-thumb,
.code_output::-webkit-scrollbar-thumb,
.path_output::-webkit-scrollbar-thumb,
.tree_view::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 3px solid rgba(7, 7, 9, 0.96);
  background: rgba(255, 196, 136, 0.72);
}

.tree_view {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tree_empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--text-muted);
  background: rgba(7, 7, 9, 0.48);
}

.tree_node {
  display: grid;
  gap: 8px;
}

.tree_row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.tree_toggle {
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.tree_select {
  width: 100%;
  min-height: 36px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
}

.tree_select:hover,
.tree_select:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.tree_select.is-selected {
  border-color: rgba(255, 196, 136, 0.34);
  background: rgba(255, 154, 66, 0.12);
}

.tree_select.is-match {
  box-shadow: inset 0 0 0 1px rgba(246, 173, 85, 0.28);
}

.tree_line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tree_key {
  color: #f8fafc;
  font-weight: 700;
}

.tree_value_preview {
  color: var(--text-soft);
}

.tree_children {
  display: grid;
  gap: 8px;
  margin-left: 18px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 196, 136, 0.12);
}

.type_chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}

.type-string { color: #f9a8d4; }
.type-number { color: #93c5fd; }
.type-boolean { color: #86efac; }
.type-null { color: #fca5a5; }
.type-array { color: #fcd34d; }
.type-object { color: #ffb97a; }

.code_output .json-key { color: #7dd3fc; }
.code_output .json-string { color: #f9a8d4; }
.code_output .json-number { color: #93c5fd; }
.code_output .json-boolean { color: #86efac; }
.code_output .json-null { color: #fca5a5; }
.code_output .json-punctuation { color: #cbd5e1; }
.code_output .json-match {
  background: rgba(246, 173, 85, 0.18);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(246, 173, 85, 0.18);
}

.builder_editor {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.builder_empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(7, 7, 9, 0.42);
  color: var(--text-muted);
}

.builder_node {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(12, 12, 14, 0.78);
}

.builder_node.is-object,
.builder_node.is-array {
  border-color: rgba(255, 196, 136, 0.16);
}

.builder_node.is-primitive {
  border-color: rgba(255, 196, 136, 0.12);
}

.builder_node_head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.builder_node_main {
  display: grid;
  gap: 10px;
  flex: 1;
}

.builder_node_title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.builder_node_title strong {
  font-family: "Sora", sans-serif;
  font-size: 0.96rem;
}

.builder_node_path {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.builder_node_controls,
.builder_node_actions,
.inline_pair {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.builder_node_controls > * {
  flex: 1 1 160px;
}

.builder_node_actions {
  justify-content: flex-end;
}

.node_action_btn,
.add_btn {
  min-height: 38px;
  padding: 0 12px;
}

.builder_node_body {
  display: grid;
  gap: 12px;
}

.builder_children {
  display: grid;
  gap: 12px;
  margin-left: 18px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 196, 136, 0.12);
}

.builder_root_actions {
  display: flex;
  justify-content: flex-end;
}

.help_panel {
  margin-top: 18px;
}

.help_grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 22px 22px;
}

.help_item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.help_item strong {
  color: var(--text);
}

.section_title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1rem;
}

.visually_hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .tool_grid {
    grid-template-columns: 1fr;
  }

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

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

  .segment_hint {
    text-align: left;
  }
}

@media (max-width: 920px) {
  .page_shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 90px;
  }

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

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

  .panel_head,
  .viewer_editor_head,
  .path_head,
  .code_head,
  .builder_editor_head,
  .builder_node_head {
    flex-direction: column;
    align-items: start;
  }

  .panel_hint {
    text-align: left;
  }

  .help_grid,
  .stats_row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .hero {
    padding: 16px 16px 22px;
    border-radius: 26px;
  }

  .segment_panel,
  .panel_head,
  .panel_body,
  .help_grid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel_head {
    padding-top: 18px;
  }

  .dropzone_stage {
    min-height: 230px;
    padding: 18px;
  }

  .viewer_code_shell {
    min-height: 420px;
  }

  .dropzone_actions,
  .viewer_editor_actions,
  .viewer_tool_actions,
  .viewer_quickstart_actions,
  .action_row_spread,
  .builder_node_controls,
  .builder_node_actions,
  .inline_pair {
    flex-direction: column;
    align-items: stretch;
  }

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

  .tree_toggle {
    width: 100%;
  }
}
