
:root {
  --bg:       #080a0f;
  --surface:  #0d1017;
  --panel:    #111520;
  --border:   #1a2035;
  --border2:  #242d45;
  --green:    #00ff88;
  --green-dim:#00cc6a;
  --green-glow: rgba(0,255,136,0.15);
  --cyan:     #00d4ff;
  --orange:   #ff8c42;
  --red:      #ff4466;
  --yellow:   #ffd166;
  --purple:   #b48eff;
  --white:    #e8edf5;
  --muted:    #4a5168;
  --muted2:   #2a3048;
  --font-mono: 'Fira Code', monospace;
  --font-ui:   'Syne', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* SCANLINES */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px);
  pointer-events: none;
  z-index: 1000;
}

/* BG GRID */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,255,136,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  animation: gridDrift 30s linear infinite;
}
@keyframes gridDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}

/* HEADER */
.header {
  position: relative;
  z-index: 10;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8,10,15,0.9);
  backdrop-filter: blur(20px);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.iv-badge {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  border: 1px solid var(--border2);
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 1px;
  transition: border-color .3s;
}
.iv-badge:hover { border-color: var(--green); }

.logo-divider { width: 1px; height: 18px; background: var(--border2); }

.logo-title {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--green);
  text-shadow: 0 0 20px rgba(0,255,136,0.4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}
.status-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* HERO */
.hero {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 56px 32px 40px;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp .8s .1s forwards;
}

.hero h1 {
  font-family: var(--font-ui);
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp .8s .2s forwards;
}

.hero h1 .accent { color: var(--green); }

.hero-sub {
  font-size: 14px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.7;
  opacity: 0;
  animation: fadeUp .8s .3s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* TOOLBAR */
.toolbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 32px 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp .8s .4s forwards;
}

.btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--panel);
  color: var(--muted);
  transition: all .2s;
  text-transform: uppercase;
}
.btn:hover { border-color: var(--green); color: var(--green); background: var(--green-glow); }
.btn.active { border-color: var(--green); color: var(--green); background: var(--green-glow); }
.btn.danger:hover { border-color: var(--red); color: var(--red); background: rgba(255,68,102,0.1); }
.btn.primary {
  border-color: var(--green);
  color: var(--bg);
  background: var(--green);
  font-weight: 600;
}
.btn.primary:hover { background: var(--green-dim); box-shadow: 0 0 20px rgba(0,255,136,0.3); }

.toolbar-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 0 12px;
  transition: border-color .2s;
}
.search-wrap:focus-within { border-color: var(--green); }
.search-wrap input {
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  padding: 7px 0;
  width: 180px;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-count { font-size: 10px; color: var(--muted); white-space: nowrap; }
.search-icon { color: var(--muted); font-size: 12px; }
.panel-title-label { margin-left: 8px; }
.tree-empty-hint { color: var(--muted2); font-size: 11px; }
.visually-hidden-input { display: none; }

/* MAIN LAYOUT */
.main {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: calc(100vh - 280px);
  min-height: 500px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  animation: fadeUp .8s .5s forwards;
}

/* PANEL */
.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.panel:last-child { border-right: none; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.panel-actions {
  display: flex;
  gap: 6px;
}

.panel-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  transition: all .2s;
  letter-spacing: 0.5px;
}
.panel-btn:hover { border-color: var(--green); color: var(--green); }

/* INPUT AREA */
.input-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.line-numbers {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 44px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.line-num {
  font-size: 11px;
  color: var(--muted2);
  text-align: right;
  padding: 0 8px 0 4px;
  line-height: 21px;
  height: 21px;
}

textarea {
  position: absolute;
  inset: 0;
  left: 44px;
  width: calc(100% - 44px);
  background: var(--panel);
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 21px;
  padding: 16px;
  resize: none;
  caret-color: var(--green);
  tab-size: 2;
}
textarea::selection { background: rgba(0,255,136,0.2); }
textarea::placeholder { color: var(--muted2); }

/* ERROR BAR */
.error-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255,68,102,0.1);
  border-top: 1px solid rgba(255,68,102,0.3);
  font-size: 11px;
  color: var(--red);
  flex-shrink: 0;
}
.error-bar.show { display: flex; }
.error-icon { font-size: 14px; }

/* SUCCESS BAR */
.success-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0,255,136,0.05);
  border-top: 1px solid rgba(0,255,136,0.2);
  font-size: 11px;
  color: var(--green);
  flex-shrink: 0;
}
.success-bar.show { display: flex; }

/* TREE PANEL */
.tree-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 16px;
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.tree-area::-webkit-scrollbar { width: 4px; }
.tree-area::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.tree-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted2);
  font-size: 12px;
  gap: 12px;
  text-align: center;
}
.tree-empty .empty-icon { font-size: 40px; opacity: 0.3; }

/* TREE NODES */
.tree-node {
  font-size: 13px;
  line-height: 1.7;
  white-space: nowrap;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  transition: background .15s;
  position: relative;
}
.tree-row:hover { background: rgba(255,255,255,0.04); }
.tree-row.highlighted { background: rgba(0,255,136,0.12) !important; }
.tree-row.copied { background: rgba(0,255,136,0.2) !important; }

.toggle-btn {
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  transition: color .2s, transform .2s;
  user-select: none;
}
.toggle-btn:hover { color: var(--green); }
.toggle-btn.collapsed { transform: rotate(-90deg); }
.toggle-spacer { width: 16px; flex-shrink: 0; }

.tree-key { color: var(--cyan); }
.tree-colon { color: var(--muted); margin: 0 4px; }
.tree-string { color: var(--green); }
.tree-number { color: var(--orange); }
.tree-boolean { color: var(--purple); }
.tree-null { color: var(--muted); font-style: italic; }
.tree-bracket { color: var(--muted); }
.tree-count { font-size: 10px; color: var(--muted); margin-left: 6px; }

.copy-path-btn {
  opacity: 0;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted);
  transition: all .15s;
  margin-left: 8px;
  letter-spacing: 0.5px;
}
.tree-row:hover .copy-path-btn { opacity: 1; }
.copy-path-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.tree-children { padding-left: 20px; border-left: 1px solid var(--border); margin-left: 7px; }
.tree-children.collapsed { display: none; }

/* STATS BAR */
.stats-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp .8s .6s forwards;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.stat-label { color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.stat-value { color: var(--green); font-weight: 600; }
.stat-value.error { color: var(--red); }
.stat-value.warn { color: var(--yellow); }

/* SAMPLES */
.samples-section {
  position: relative;
  z-index: 10;
  padding: 24px 32px;
  opacity: 0;
  animation: fadeUp .8s .7s forwards;
}

.samples-title {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.samples-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--panel);
  color: var(--muted);
  transition: all .2s;
  letter-spacing: 0.5px;
}
.sample-btn:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(0,212,255,0.05); }

/* ===== FOOTER ===== */

footer {
  margin-top: 100px;
  padding: 60px 0 40px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
}

.footer-links a {
  text-decoration: none;
  color: inherit;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: #e8f542;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 0;
  align-items: center;
}

.footer-links a:not(:last-child)::after {
  content: '|';
  margin: 0 0.6em;
  opacity: 0.3;
  color: inherit;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 12px;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 9999;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(0,255,136,0.2);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .main { grid-template-columns: 1fr; height: auto; }
  .panel { min-height: 300px; }
  .panel:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  .header { padding: 16px 20px; }
  .toolbar, .stats-bar, .samples-section { padding: 12px 20px; }
  .search-wrap { margin-left: 0; width: 100%; }
  .search-wrap input { width: 100%; }
  .hero { padding: 40px 20px 24px; }
}

