*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Syne Mono', monospace;
  min-height: 100vh;
  background: linear-gradient(180deg, #d4e8ff 0%, #e8f0fe 30%, #ffffff 60%, #e0ecff 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Cloud background */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 500px; height: 200px;
  top: 60px; left: -50px;
  box-shadow:
    300px 50px 80px rgba(255,255,255,0.5),
    700px -20px 100px rgba(255,255,255,0.4),
    1100px 40px 90px rgba(255,255,255,0.45);
}
body::after {
  width: 400px; height: 180px;
  top: 300px; right: -80px;
  box-shadow:
    -400px 100px 100px rgba(255,255,255,0.4),
    -900px 50px 80px rgba(255,255,255,0.35);
}

.cloud {
  position: fixed;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
}
.cloud-1 { width: 600px; height: 150px; top: 15%; left: 10%; }
.cloud-2 { width: 400px; height: 120px; top: 50%; right: 5%; }
.cloud-3 { width: 500px; height: 130px; top: 75%; left: 30%; }

header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 20px 8px;
}
header h1 {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
  font-size: 42px;
  background: linear-gradient(135deg, #1a3a5c 0%, #3b82f6 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.8px;
}
header p {
  color: #5a7a9a;
  font-size: 13px;
  margin-top: 2px;
  font-weight: 400;
}

.container {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 20px;
  padding: 16px 24px 32px;
  height: calc(100vh - 100px);
  max-width: 1600px;
  margin: 0 auto;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-right .glass-card {
  flex: 1;
  min-height: 0;
}

.panel-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #4a6a8a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#format-badge:empty { display: none; }
#format-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.glass-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 4px 24px rgba(100, 140, 200, 0.12),
    0 1px 3px rgba(100, 140, 200, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 20px;
  font-family: 'Syne Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #1e293b;
  background: transparent;
}
#input::placeholder {
  color: #94a3b8;
}

/* Breadcrumb bar */
#breadcrumb {
  font-family: 'Syne Mono', monospace;
  font-size: 12px;
  color: #4a6a8a;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 8px 14px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}
#breadcrumb:empty::before {
  content: 'Click a node to see its path';
  color: #94a3b8;
  font-family: 'Syne Mono', monospace;
  font-style: italic;
  font-size: 12px;
}
.crumb {
  color: #3b82f6;
  font-weight: 500;
}
.crumb-sep {
  color: #b0c4de;
  margin: 0 2px;
}
.crumb-eq {
  color: #94a3b8;
  margin: 0 3px;
}
.crumb-val {
  color: #16803c;
  font-weight: 400;
  word-break: break-all;
}

/* Output panel */
#output {
  padding: 20px;
  font-family: 'Syne Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  flex: 1;
  cursor: default;
  user-select: text;
  white-space: pre;
}

/* JSON syntax tokens */
.json-key { color: #0f63a5; font-weight: 500; }
.json-string { color: #16803c; }
.json-number { color: #b45309; }
.json-bool { color: #9333ea; font-weight: 500; }
.json-null { color: #9333ea; font-style: italic; }
.json-bracket { color: #64748b; }
.json-comma { color: #94a3b8; }
.json-colon { color: #94a3b8; }

/* Collapsible nodes */
.json-toggle {
  cursor: pointer;
  display: inline;
  position: relative;
}
.json-toggle:hover {}
.json-toggle::before {
  content: '';
}
.json-toggle.collapsed .json-content {
  display: none;
}
.json-toggle.collapsed .json-collapsed-placeholder {
  display: inline;
}
.json-collapsed-placeholder {
  display: none;
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
}
.json-clickable {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 2px;
  margin: 0 -2px;
}
.json-clickable:hover {}

/* JSONL separator */
.jsonl-separator {
  border: none;
  border-top: 1px dashed #b0c4de;
  margin: 8px 0;
}

/* Error display */
.json-error {
  color: #dc2626;
  font-family: 'Syne Mono', monospace;
  font-size: 13px;
  padding: 12px;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

/* Scrollbar styling */
#output::-webkit-scrollbar,
#input::-webkit-scrollbar {
  width: 8px;
}
#output::-webkit-scrollbar-track,
#input::-webkit-scrollbar-track {
  background: transparent;
}
#output::-webkit-scrollbar-thumb,
#input::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}
#output::-webkit-scrollbar-thumb:hover,
#input::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}
