:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --ink: #1f2333;
  --muted: #596079;
  --accent: #1066d1;
  --accent-2: #0c4a98;
  --ok: #0c8a54;
  --warn: #b25f00;
  --danger: #b43244;
  --line: #d8deea;
  --shadow: 0 16px 32px rgba(31, 35, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, #dce9ff 0%, transparent 36%),
    radial-gradient(circle at 90% 0%, #ffe8c9 0%, transparent 32%),
    var(--bg);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  min-height: 100vh;
}

.app-shell {
  width: min(1200px, 94vw);
  margin: 2rem auto;
  padding: 1.4rem;
}

.hero {
  margin-bottom: 1rem;
  animation: rise-in 450ms ease-out;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.3vw, 2.5rem);
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0.5rem 0;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  border: 1px solid #bbe1cb;
  background: #eafaf0;
  color: #18683f;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.mode-panel.hidden {
  display: none;
}

button.mode-btn {
  background: #edf2fb;
  color: #253454;
  border: 1px solid #ccd8ee;
  box-shadow: none;
}

button.mode-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: #0f53ab;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.single-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pane h2 {
  margin: 0;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}

textarea {
  width: 100%;
  min-height: 340px;
  border: 0;
  resize: vertical;
  outline: none;
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  font-family: "Cascadia Mono", "Fira Mono", "Consolas", monospace;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 0.68rem 1.1rem;
  border-radius: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

button.secondary {
  background: #edf2fb;
  color: #23314f;
  border: 1px solid #ccd8ee;
}

button:hover {
  transform: translateY(-1px);
}

#status,
#singleStatus {
  color: var(--muted);
  font-size: 0.9rem;
}

.results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: rise-in 500ms ease-out;
}

.summary {
  margin-bottom: 0.8rem;
  color: #20304f;
  font-weight: 600;
}

.result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.result-columns h3 {
  margin: 0 0 0.6rem;
}

.issue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.issue-list li {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #fafcff;
}

.issue-list li.error {
  border-left-color: var(--danger);
}

.issue-list li.warning {
  border-left-color: var(--warn);
}

.issue-list li.info {
  border-left-color: var(--ok);
}

.issue-path {
  font-family: "Cascadia Mono", "Fira Mono", "Consolas", monospace;
  font-size: 0.85rem;
  color: #20304f;
}

.issue-msg {
  margin-top: 0.2rem;
  color: #2a3554;
}

.tree-section {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: rise-in 550ms ease-out;
}

.tree-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.tree-header p {
  margin: 0.35rem 0 0.9rem;
  color: var(--muted);
}

.tree-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
}

.tree-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #ccd8ee;
  border-radius: 9px;
  background: #f2f6ff;
  color: #273553;
  font-size: 0.85rem;
}

.tree-toggle input {
  accent-color: #1066d1;
}

.tree-tool-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.tree-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.tree-pane {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.tree-pane h3 {
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: #f4f7ff;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.single-warning-box {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #f1d2a6;
  border-radius: 12px;
  background: #fff8ee;
}

.single-warning-box h3 {
  margin: 0 0 0.35rem;
  color: #6c3f00;
  font-size: 0.96rem;
}

.single-warning-summary {
  margin: 0 0 0.45rem;
  color: #7b4a00;
  font-size: 0.88rem;
}

.single-warning-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.single-warning-list li {
  border: 1px solid #f1d2a6;
  border-radius: 8px;
  background: #fffdf8;
  padding: 0.45rem 0.55rem;
}

.single-warning-path {
  font-family: "Cascadia Mono", "Fira Mono", "Consolas", monospace;
  color: #623300;
  font-size: 0.82rem;
}

.single-warning-msg {
  color: #7b4a00;
  font-size: 0.85rem;
}

.single-tree-pane {
  max-width: 100%;
}

.tree-root {
  padding: 0.75rem 0.85rem;
  min-height: 240px;
  max-height: 540px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
}

.tree-placeholder {
  margin: 0;
  padding: 0.6rem 0.7rem;
  border: 1px dashed #c3d1eb;
  border-radius: 9px;
  color: #42527a;
}

.tree-list {
  list-style: none;
  margin: 0;
  padding-left: 1rem;
  border-left: 1px solid #d7e0f3;
}

.tree-root-list {
  list-style: none;
  margin: 0;
  padding-left: 0;
  border-left: 0;
}

.tree-item {
  margin: 0.35rem 0;
}

.tree-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  color: #1d2f52;
  line-height: 1.3;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
}

.tree-label {
  font-family: "Cascadia Mono", "Fira Mono", "Consolas", monospace;
  font-size: 0.85rem;
}

.tree-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.1rem 0.46rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.tree-tag.kind {
  color: #0f4e9a;
  background: #e7f0ff;
  border: 1px solid #bfd5fb;
}

.tree-tag.nullable {
  color: #18683f;
  background: #e8f8ed;
  border: 1px solid #b9e2c7;
}

.tree-tag.default {
  color: #7a4c00;
  background: #fff3de;
  border: 1px solid #f4d6a0;
}

.tree-tag.ref {
  color: #5f2f88;
  background: #f5ebff;
  border: 1px solid #d9c1f7;
}

.tree-tag.meta {
  color: #37476e;
  background: #edf2fb;
  border: 1px solid #cfdbf0;
}

.tree-details {
  margin: 0;
}

.tree-details > summary {
  cursor: pointer;
  list-style: none;
}

.tree-details > summary::-webkit-details-marker {
  display: none;
}

.tree-item.has-diff > .tree-row,
.tree-item.has-diff > .tree-details > summary {
  font-weight: 700;
}

.tree-item.is-selected > .tree-row,
.tree-item.is-selected > .tree-details > summary {
  background: #dbeeff;
  box-shadow: inset 0 0 0 1px #9fc6f3;
}

.tree-item.schema-warning > .tree-row,
.tree-item.schema-warning > .tree-details > summary {
  background: #fff4e7;
  box-shadow: inset 0 0 0 1px #f2d6b0;
}

.tree-item.align-focus > .tree-row,
.tree-item.align-focus > .tree-details > summary {
  animation: align-pulse 900ms ease-out;
}

.tree-item.diff-error > .tree-row,
.tree-item.diff-error > .tree-details > summary {
  background: #ffe8ec;
  box-shadow: inset 0 0 0 1px #f2bec7;
}

.tree-item.diff-warning > .tree-row,
.tree-item.diff-warning > .tree-details > summary {
  background: #fff2df;
  box-shadow: inset 0 0 0 1px #f3d8ab;
}

.tree-item.diff-info > .tree-row,
.tree-item.diff-info > .tree-details > summary {
  background: #e8f4ff;
  box-shadow: inset 0 0 0 1px #c2dbfa;
}

@media (max-width: 980px) {
  .grid,
  .result-columns,
  .tree-columns {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 260px;
  }
}

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

@keyframes align-pulse {
  from {
    box-shadow: inset 0 0 0 2px #0f62d0;
  }
  to {
    box-shadow: inset 0 0 0 1px #c2dbfa;
  }
}
