:root {
  --bg: #060a09;
  --bg-soft: #0b1211;
  --panel: #0c1413;
  --panel-2: #0f1a18;
  --line: #1a2b27;
  --line-soft: #142320;
  --text: #d8e7e2;
  --muted: #6d867e;
  --dim: #4a5f59;
  --accent: #2fe6a8;
  --accent-dim: rgba(47, 230, 168, 0.12);
  --warn: #ffb454;
  --danger: #ff6b6b;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(47, 230, 168, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(47, 230, 168, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
  z-index: 0;
}

body > *:not(.grid-bg) { position: relative; z-index: 1; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(6, 10, 9, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.brand-path { color: var(--text); }
.brand-sep { color: var(--dim); }
.brand-mod { color: var(--accent); }

.pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- layout ---------- */

main {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  flex: 1;
}

.hero { margin-bottom: 40px; }

h1 {
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: -0.03em;
  font-weight: 650;
  background: linear-gradient(170deg, #ffffff 10%, #9fd6c4 60%, #2fe6a8 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 15px;
  max-width: 620px;
}

.sub b { color: var(--text); font-weight: 600; }

/* ---------- search ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search:focus-within {
  border-color: rgba(47, 230, 168, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 8px 30px rgba(0, 0, 0, 0.4);
}

.prompt { color: var(--accent); font-family: var(--mono); font-size: 16px; }

#q {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  padding: 12px 0;
}

#q::placeholder { color: var(--dim); }

#go {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #04120d;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 22px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

#go:hover { background: #4df3ba; }
#go:active { transform: scale(0.98); }
#go:disabled { background: #1b2f28; color: var(--dim); cursor: not-allowed; }

.examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--dim);
}

.ex {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ex:hover { color: var(--accent); border-color: rgba(47, 230, 168, 0.45); background: var(--accent-dim); }

/* ---------- status / error ---------- */

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding: 18px 0;
}

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  color: #ffb3b3;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
}

/* ---------- metrics ---------- */

.result { animation: fadein 0.35s ease both; }

@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.metric {
  background: var(--panel);
  padding: 18px 18px 16px;
  min-width: 0;
}

.metric-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.metric-value.accent { color: var(--accent); }
.metric-value.ok { color: var(--accent); }
.metric-value.warn { color: var(--warn); }
.metric-value.bad { color: var(--danger); }

.metric-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 18px;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.warn-item {
  font-size: 13px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.07);
  border-left: 2px solid rgba(255, 180, 84, 0.6);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
}

/* ---------- panels ---------- */

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  min-width: 0;
}

.panels .panel { margin-bottom: 0; }

.panel h2 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 14px;
  font-weight: 600;
}

/* kv list */

.kv {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 9px 14px;
  margin: 0;
  font-size: 13.5px;
}

.kv dt { color: var(--dim); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* dns rows */

.dns-group { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.dns-group:last-child { border-bottom: 0; }

.dns-type {
  flex: none;
  width: 52px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  padding-top: 2px;
  letter-spacing: 0.04em;
}

.dns-vals { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dns-val { font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-all; }
.dns-val .pri { color: var(--muted); }
.dns-empty { font-size: 12.5px; color: var(--dim); font-style: italic; }

/* chain */

.chain-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 13px;
}

.chain-row:last-child { border-bottom: 0; }

.chain-code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 2px 0;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--muted);
}

.chain-code.s2 { color: var(--accent); background: var(--accent-dim); }
.chain-code.s3 { color: var(--warn); background: rgba(255, 180, 84, 0.1); }
.chain-code.s4, .chain-code.s5 { color: var(--danger); background: rgba(255, 107, 107, 0.1); }

.chain-url { font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--text); }
.chain-ms { font-family: var(--mono); font-size: 11.5px; color: var(--dim); white-space: nowrap; }

/* chips */

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s ease;
  max-width: 100%;
}

.chip:hover { border-color: rgba(47, 230, 168, 0.4); }

.chip .cat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--dim);
  text-transform: uppercase;
}

.chip .ver { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.chip.weak { opacity: 0.72; }

.chip .ev {
  font-size: 11px;
  color: var(--dim);
  border-left: 1px solid var(--line);
  padding-left: 7px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* details / headers */

details summary {
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 10px;
  transition: transform 0.15s ease;
}
details[open] summary::before { transform: rotate(90deg); }

pre.mono {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  background: #070d0c;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  max-height: 320px;
}

.muted { color: var(--dim); font-weight: 400; letter-spacing: 0; text-transform: none; }

/* actions */

.actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ghost:hover { color: var(--accent); border-color: rgba(47, 230, 168, 0.4); }

/* history */

.history-wrap { margin-top: 44px; }

.history-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 12px;
  font-weight: 600;
}

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

.hist {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hist:hover { color: var(--accent); border-color: rgba(47, 230, 168, 0.35); }
.hist .hist-ip { color: var(--dim); margin-left: 8px; font-size: 11px; }

/* footer */

footer {
  border-top: 1px solid var(--line-soft);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--dim);
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

/* responsive */

@media (max-width: 760px) {
  main { padding: 40px 16px 32px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .panels { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .metric-value { font-size: 17px; }
  footer { flex-direction: column; }
  .chain-row { grid-template-columns: 48px 1fr; }
  .chain-ms { grid-column: 2; color: var(--dim); }
}
