:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-alt: #16202b;
  --border: #212e3b;
  --text-primary: #e8edf2;
  --text-muted: #7c8b99;
  --accent-cyan: #4fd1c5;
  --accent-amber: #f0a860;
  --accent-red: #e0566b;
  --accent-blue: #5b8def;
  --accent-idle: #3a4856;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  font-size: 26px;
  color: var(--accent-cyan);
  line-height: 1;
  animation: spin-slow 6s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.query-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  flex: 1;
  max-width: 720px;
  min-width: 320px;
}

.prompt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  padding: 0 10px;
  white-space: nowrap;
}

.query-bar input[type="text"] {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 6px;
}

#domain-input { flex: 1.3; min-width: 120px; }
#expected-input { flex: 1; min-width: 100px; border-left: 1px solid var(--border); }

.query-bar select {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 6px;
  border-radius: 5px;
  margin: 0 4px;
}

.query-bar button {
  background: var(--accent-cyan);
  color: #06110f;
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.query-bar button:hover { filter: brightness(1.08); }
.query-bar button:active { transform: scale(0.97); }
.query-bar button:disabled { filter: grayscale(0.6); cursor: progress; }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 0;
}

.map-panel { position: relative; background: #0a0d11; }
#map { width: 100%; height: 100%; background: #0a0d11; }

.map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  pointer-events: none;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(10, 13, 17, 0.35);
}
.map-empty.hidden { display: none; }

/* Radar sweep signature element */
.radar-sweep {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow: hidden;
}
.radar-sweep.active { opacity: 1; }
.radar-sweep::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220vmax;
  height: 220vmax;
  margin: -110vmax 0 0 -110vmax;
  background: conic-gradient(from 0deg, rgba(79, 209, 197, 0.22), transparent 22%);
  animation: sweep 2.4s linear infinite;
}
@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Leaflet marker overrides ---------- */
/* Markers are HTML (L.divIcon), not SVG, so plain CSS (background,
   border-radius, box-shadow) applies correctly. */
.dns-marker-wrapper {
  background: transparent !important;
  border: none !important;
}

.dns-marker {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}
.dns-marker.idle { background: var(--accent-idle); }
.dns-marker.ok { background: var(--accent-cyan); box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.6); animation: pulse-ok 1.6s ease-out 1; }
.dns-marker.mismatch { background: var(--accent-amber); box-shadow: 0 0 0 0 rgba(240, 168, 96, 0.6); animation: pulse-amber 1.6s ease-out 1; }
.dns-marker.error, .dns-marker.timeout, .dns-marker.nxdomain, .dns-marker.nodata {
  background: var(--accent-red); box-shadow: 0 0 0 0 rgba(224, 86, 107, 0.6); animation: pulse-red 1.6s ease-out 1;
}

@keyframes pulse-ok {
  0% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(79, 209, 197, 0); }
}
@keyframes pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(240, 168, 96, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(240, 168, 96, 0); }
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(224, 86, 107, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(224, 86, 107, 0); }
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
}
.leaflet-popup-tip { background: var(--panel); }
.popup-title { font-family: var(--font-display); font-size: 13px; margin: 0 0 4px; }
.popup-meta { font-size: 11px; color: var(--text-muted); margin: 0 0 8px; }
.popup-status { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 4px; margin-bottom: 8px; }
.popup-records { font-family: var(--font-mono); font-size: 11px; margin: 0; padding-left: 16px; max-width: 220px; word-break: break-all; }

/* ---------- Side panel ---------- */
.side-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.summary { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.summary-row.muted { margin: 8px 0 0; }
.summary-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--accent-cyan); }
#summary-detail { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

.gauge { height: 6px; background: var(--panel-alt); border-radius: 3px; overflow: hidden; }
.gauge-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-amber), var(--accent-cyan)); transition: width 0.6s ease; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--accent-cyan); }
.dot.mismatch { background: var(--accent-amber); }
.dot.error { background: var(--accent-red); }
.dot.idle { background: var(--accent-idle); }

.resolver-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.resolver-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: default;
  transition: background 0.12s ease;
}
.resolver-row:hover { background: var(--panel-alt); }

.resolver-row .dot { flex-shrink: 0; }

.resolver-info { flex: 1; min-width: 0; }
.resolver-name { font-size: 12.5px; font-weight: 500; }
.resolver-meta { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); }
.resolver-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Footer ---------- */
.footnote {
  padding: 8px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.footnote p {
  margin: 0;
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr 280px; }
  .side-panel { border-left: none; border-top: 1px solid var(--border); }
  .query-bar { max-width: none; width: 100%; }
}

/* ---------- Accessibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark, .radar-sweep::before, .dns-marker { animation: none !important; }
}
