:root {
  /* palette aligned with location.html */
  --bg:          #080808;
  --surface:     #101010;
  --surface-alt: #0d0d0d;
  --panel-line:  #222;
  --accent:      #0081cf;
  --accent-dim:  rgba(0, 129, 207, 0.08);
  --accent-glow: rgba(0, 129, 207, 0.4);
  --text:        #ccc;
  --muted:       #555;
  --label:       #666;
  --warn:        #ffcc00;
  --danger:      #ff4d6d;
  --danger-dim:  rgba(255, 77, 109, 0.08);
  --glow:        0 0 8px var(--accent-glow);
}

* { box-sizing: border-box; }

html, body { height: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Share Tech Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}

/* ---- dark themed scrollbars (match label forecolors) ---- */
html {
  scrollbar-width: thin;                      /* Firefox */
  scrollbar-color: var(--label) var(--bg);    /* thumb #666 (ADDRESS DATA) / track */
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--label);                    /* #666 — ADDRESS DATA */
  border: 3px solid var(--bg);                 /* inset pill on the track */
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text); }  /* #ccc — VIEW RAW JSON */
::-webkit-scrollbar-corner { background: var(--bg); }

/* JSON textarea: scrollbar a touch lighter than its #0d0d0d background so it stays faintly visible */
textarea#raw { scrollbar-color: #1d1d25 var(--surface-alt); }
textarea#raw::-webkit-scrollbar-track { background: var(--surface-alt); }
textarea#raw::-webkit-scrollbar-thumb {
  background: #1d1d25;
  border-color: var(--surface-alt);
}
textarea#raw::-webkit-scrollbar-thumb:hover { background: #2a2a34; }

#grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.3;
  mix-blend-mode: multiply;
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 920px;
  margin: 0 auto;
  padding: 26px 20px 70px;
}

/* ---- header wordmark ---- */
.brand {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.25em;
  font-size: 13px;
  color: var(--accent);
  text-shadow: var(--glow);
  text-transform: lowercase;
}
.brand a { color: inherit; text-decoration: none; }
.brand .dot { color: var(--text); }

/* ---- hero ---- */
.hero { margin-top: 46px; }
h1 {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 8vw, 64px);
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.05;
  color: #eee;
  text-shadow: 0 0 16px var(--accent-glow), 0 0 4px var(--accent-glow);
}
.caption {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--label);
}

/* ---- query bar ---- */
.querybar {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.field {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  padding: 0 14px;
}
.field .prefix {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--label);
  text-transform: uppercase;
  white-space: nowrap;
}
.field input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 13px 0;
  min-width: 0;
}
.field input::placeholder { color: var(--muted); }

button {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0 22px;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
  text-shadow: 0 0 6px var(--accent-glow);
}
button:hover {
  background: rgba(0, 129, 207, 0.15);
  box-shadow: 0 0 16px var(--accent-glow), inset 0 0 10px var(--accent-dim);
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.ghost {
  color: var(--label);
  background: transparent;
  border-color: var(--panel-line);
  text-shadow: none;
}
button.ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: none;
}

/* ---- status line ---- */
.status {
  margin-top: 22px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 16px;
}
.status .led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.status.busy .led { background: var(--warn); box-shadow: 0 0 6px rgba(255, 204, 0, 0.5); animation: pulse 1.2s infinite ease-in-out; }
.status.ok   .led { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.status.err  .led { background: var(--danger); box-shadow: 0 0 8px rgba(255, 77, 109, 0.4); }
.status.err  { color: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- section label ---- */
.section-label {
  margin: 40px 0 16px;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--panel-line), transparent);
}

/* ---- data grid (minimal) ---- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 22px 28px;
  padding: 26px;
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  background: var(--surface);
}
.card { min-width: 0; }
.card .k {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 8px;
}
.card .v {
  font-size: 15px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}
.card .v.accent { color: var(--accent); text-shadow: 0 0 10px var(--accent-glow); }
.card .v .sub { color: var(--muted); font-size: 12px; }
.card.wide { grid-column: 1 / -1; }
.flag {
  height: 14px;
  width: auto;
  vertical-align: -2px;
  margin-right: 7px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ---- collapsible raw json ---- */
.raw-toggle {
  margin-top: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  padding: 16px 18px;
  cursor: pointer;
  color: var(--text);
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 12px;
  text-transform: uppercase;
  transition: border-color 0.15s ease;
  text-shadow: none;
  min-height: 0;
}
.raw-toggle:hover { border-color: var(--accent); background: var(--surface); box-shadow: none; }
.raw-toggle .chev { transition: transform 0.25s ease; color: var(--accent); }
.raw-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

.raw-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-left: 1px solid var(--panel-line);
  border-right: 1px solid var(--panel-line);
}
.raw-panel.open { max-height: 1400px; border-bottom: 1px solid var(--panel-line); border-radius: 0 0 2px 2px; }
.raw-inner { position: relative; }
textarea#raw {
  width: 100%;
  height: 420px;
  resize: none;
  background: var(--surface-alt);
  color: var(--accent);
  border: 0;
  outline: 0;
  padding: 16px 16px 16px 18px;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  white-space: pre;
  tab-size: 2;
  text-shadow: 0 0 6px var(--accent-glow);
}
.raw-actions {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 8px;
}
.copybtn {
  min-height: 0;
  padding: 8px 14px;
  font-size: 10px;
  letter-spacing: 0.16em;
}

/* ---- footer ---- */
footer {
  margin-top: 56px;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 540px) {
  .field { flex-basis: 100%; }
  button.query-btn { flex: 1; }
}
