:root {
  --bg: #ecf2fb;
  --card: #ffffff;
  --text: #1f2a38;
  --muted: #607186;
  --line: #d3deed;
  --accent: #0f766e;
  --accent2: #1d4ed8;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 2%, rgba(29, 78, 216, 0.08), transparent 35%),
    radial-gradient(circle at 88% 1%, rgba(15, 118, 110, 0.08), transparent 35%),
    var(--bg);
}

.topbar {
  height: 42px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 14px;
  font-weight: 700;
}

.topbar nav {
  display: flex;
  gap: 10px;
}

.topbar a {
  color: var(--accent2);
  text-decoration: none;
  font-size: 11px;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px;
}

.hero-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.77);
  padding: 12px;
  margin-bottom: 8px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.hero-copy h1 {
  margin: 0 0 8px;
  font-size: 23px;
  line-height: 1.15;
}

.hero-copy p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.35;
  color: #435569;
}

.scroll-cta {
  display: inline-block;
  margin-top: 4px;
}

.hero-art {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fbff;
}

.hero-art svg {
  width: 100%;
  height: 100%;
  min-height: 250px;
}

.section-block {
  margin-bottom: 8px;
}

.section-title {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  padding: 7px 8px;
  margin-bottom: 8px;
}

.section-title h2 {
  margin: 0;
  font-size: 14px;
}

.demo-section,
.demo-section h2,
.demo-section h3,
.demo-section .muted,
.demo-section .fields,
.demo-section .btn,
.demo-section .mono,
.demo-section .pre {
  font-size: 10px;
}

.result-section,
.result-section h2,
.result-section h3,
.result-section .muted,
.result-section .fields,
.result-section .pre,
.result-section th,
.result-section td,
.result-section .verdict {
  font-size: 10px;
}

.demo-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.demo-builder {
  display: grid;
  grid-template-columns: 0.9fr 1.5fr 1.1fr;
  gap: 8px;
}

.middle-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.2fr 1fr;
  gap: 8px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 7px;
  box-shadow: 0 8px 20px rgba(17, 35, 56, 0.06);
  overflow: auto;
}

.demo-builder .panel {
  max-height: calc(100vh - 170px);
}

h2,
h3 {
  margin: 0 0 5px;
}

h2 {
  font-size: 13px;
}

h3 {
  color: var(--muted);
}

.muted {
  margin: 0 0 5px;
  color: var(--muted);
}

.muted.error {
  color: var(--bad);
  font-weight: 600;
}

.fields {
  margin: 0 0 6px;
  padding-left: 14px;
}

.fields li {
  margin-bottom: 2px;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  background: #fff;
  color: var(--accent2);
  border: 1px solid var(--accent2);
}

.btn.small {
  padding: 4px 6px;
}

.btn.danger {
  border-color: #efc2c2;
  color: #a11e1e;
  background: #fff7f7;
}

.artifact-row {
  margin: 0 0 6px;
}

.pre {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
  margin: 0 0 6px;
  min-height: 72px;
  background: #fbfdff;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mono {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mono.prompt {
  min-height: 130px;
}

.mono.preview {
  min-height: 205px;
  font-size: 6px;
  line-height: 1.2;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.schema-tree-nav {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 6px;
}

.tree-item {
  margin-bottom: 2px;
}

.tree-item.active > .tree-btn {
  background: #dbeafe;
  color: #1e3a8a;
  border-color: #93c5fd;
}

.tree-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #d3deec;
  border-radius: 6px;
  background: #fff;
  padding: 4px 6px;
  cursor: pointer;
}

.field-name {
  color: #1d4ed8;
  font-weight: 700;
}

.field-meta {
  color: #495a70;
}

.tree-nested {
  margin-left: 14px;
  margin-top: 2px;
}

.node-editor {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 6px;
}

.node-editor-scroll {
  max-height: 200px;
  overflow: auto;
}

.subblock {
  margin-bottom: 6px;
}

.desc-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
  font-size: 8px;
  min-height: 58px;
  max-height: 58px;
  resize: none;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.editor-headline {
  font-weight: 700;
  margin-bottom: 6px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr auto auto auto;
  gap: 5px;
  align-items: center;
  margin-bottom: 5px;
}

.editor-row input,
.editor-row select,
.leaf-line input,
.leaf-line select {
  width: 100%;
  border: 1px solid #cbd8e9;
  border-radius: 6px;
  padding: 5px;
  background: #fff;
}

.req {
  display: flex;
  align-items: center;
  gap: 2mm;
}

.leaf-editor {
  display: grid;
  gap: 6px;
}

.leaf-line {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px;
  align-items: center;
}

.run-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.verdict-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.verdict {
  display: inline-block;
  border-radius: 6px;
  background: #e5e7eb;
  padding: 4px 6px;
  font-weight: 700;
}

.verdict.accepted {
  background: #dcfce7;
  color: #065f46;
}

.verdict.warn {
  background: #ffedd5;
  color: #9a3412;
}

.verdict.bad {
  background: #fee2e2;
  color: #991b1b;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 4px;
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 1140px) {
  .hero-grid,
  .demo-top,
  .demo-builder,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .demo-builder .panel {
    max-height: none;
  }

  .editor-row {
    grid-template-columns: 1fr;
    border: 1px solid #e3ebf6;
    border-radius: 7px;
    padding: 6px;
    background: #fff;
  }

  .leaf-line {
    grid-template-columns: 1fr;
  }
}
