*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0, #050816 38%);
  color: #e5e7eb;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px clamp(16px, 4vw, 40px);
  gap: 20px;
}

.app-header {
  max-width: 880px;
  margin: 0 auto;
  text-align: left;
}
.app-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.app-header__title h1 {
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.03em;
  margin: 0;
  background: linear-gradient(120deg, #e5e7eb, #22d3ee, #a855f7);
  -webkit-background-clip: text;
  color: transparent;
}
.app-header__subtitle {
  margin: 0;
  color: #9ca3af;
  font-size: 14px;
}

.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-radius: 999px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(56, 189, 248, 0.03));
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #22d3ee;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: stretch;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(20px);
}
.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.panel__header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #020617;
  background: linear-gradient(145deg, #06b6d4, #22d3ee);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.8);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out, background 160ms ease-out,
    color 160ms ease-out;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(8, 47, 73, 0.95);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(8, 47, 73, 0.9);
}
.btn--secondary {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: none;
}
.btn--secondary:hover {
  border-color: rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
}
.btn--ghost {
  background: transparent;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #9ca3af;
  padding-inline: 10px;
  box-shadow: none;
}
.btn--ghost:hover {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(15, 23, 42, 0.9);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.toolbar__left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar__right {
  display: flex;
  justify-content: flex-end;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9ca3af;
}
.checkbox input {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  appearance: none;
  background: transparent;
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}
.checkbox input:checked {
  background: #22d3ee;
  border-color: #22d3ee;
}
.checkbox input:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 3px;
  background: #020617;
}

.json-input {
  width: 100%;
  min-height: 240px;
  max-height: 380px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 10px 11px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  color: #e5e7eb;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  outline: none;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out, background 160ms ease-out;
}
.json-input:focus {
  border-color: rgba(34, 211, 238, 0.7);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.5);
}
.json-input::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.status {
  margin: 4px 1px 0;
  min-height: 18px;
  font-size: 11px;
  color: #9ca3af;
  white-space: pre-wrap;
}
.status--error {
  color: #fb7185;
}
.status--success {
  color: #4ade80;
}

.viewer {
  position: relative;
  flex: 1;
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #020617;
  padding: 10px 11px;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.56;
}
.viewer__placeholder {
  color: #9ca3af;
  font-size: 12px;
}
.viewer--large {
  white-space: pre;
}

.json-node {
  position: relative;
  padding-left: 14px;
}

.json-line {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.json-toggle {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
  color: #9ca3af;
  transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out,
    transform 160ms ease-out;
}
.json-toggle:hover {
  border-color: #22d3ee;
  color: #22d3ee;
  background: rgba(15, 23, 42, 1);
  transform: translateY(-0.5px);
}

.json-toggle--empty {
  opacity: 0;
  pointer-events: none;
}

.json-key {
  color: #38bdf8;
}

.json-type-object,
.json-type-array {
  color: #a855f7;
}

.json-string {
  color: #22c55e;
}

.json-number {
  color: #fbbf24;
}

.json-boolean {
  color: #fb7185;
}

.json-null {
  color: #9ca3af;
  font-style: italic;
}

.json-punctuation {
  color: #64748b;
}

.json-collapsed .json-children {
  display: none;
}

.json-children {
  margin-left: 14px;
  border-left: 1px solid rgba(30, 64, 175, 0.7);
  padding-left: 8px;
}

.json-ellipsis {
  color: #9ca3af;
  opacity: 0.85;
}

.app-footer {
  max-width: 880px;
  margin: 0 auto;
  padding-top: 4px;
  font-size: 11px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
}

.loading-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.3), rgba(2, 6, 23, 0.9));
  backdrop-filter: blur(6px);
  z-index: 40;
}
.loading-backdrop--visible {
  display: flex;
}

.loading-box {
  background: rgba(15, 23, 42, 0.98);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  padding: 14px 18px 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #22d3ee;
  animation: spin 700ms linear infinite;
}

.loading-text {
  font-size: 13px;
  color: #9ca3af;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 600px) {
  .panel {
    padding: 14px 12px;
  }
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar__right {
    width: 100%;
    justify-content: flex-start;
  }
  .app {
    padding-inline: 12px;
  }
}

