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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --error: #f85149;
  --warn: #d29922;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji";
  --mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---- Header / Brand ---- */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}

.brand-accent { color: var(--accent); }


/* ---- Layout ---- */

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 32px;
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  font-family: var(--font);
  padding: 10px 20px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Forms ---- */

form { display: flex; flex-direction: column; gap: 18px; max-width: 620px; }

.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }

input, select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }
select option { background: var(--surface); }

button[type="submit"] {
  align-self: flex-start;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #0d1117;
  cursor: pointer;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 24px;
  transition: background .15s, opacity .15s;
}

button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Results section ---- */

.results-section {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.status-bar {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 22px;
}

.status-bar.busy { color: var(--warn); }
.status-bar.ok   { color: var(--success); }
.status-bar.err  { color: var(--error); }

/* Action bar (Copy / Export) */
.result-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.result-actions[hidden] { display: none; }

.action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  transition: color .15s, border-color .15s;
}

.action-btn:hover { color: var(--text); border-color: var(--muted); }
.action-btn.copied { color: var(--success); border-color: var(--success); }

#results { min-height: 40px; }

/* ---- DNS results ---- */

.record-group { margin-bottom: 20px; }

.record-type-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.type-badge {
  background: var(--accent);
  color: #0d1117;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 4px;
}

.type-badge.type-aaaa  { background: #79b8ff; }
.type-badge.type-mx    { background: #56d364; }
.type-badge.type-txt   { background: #bc8cff; }
.type-badge.type-ns    { background: #e3b341; }
.type-badge.type-cname { background: #39d0d8; }
.type-badge.type-soa   { background: var(--muted); }
.type-badge.type-caa   { background: #f78166; }
.type-badge.type-ds    { background: #d2a8ff; }
.type-badge.type-ptr   { background: #79c0ff; }
.type-badge.type-srv   { background: #ffa657; }

.record-count { font-size: 12px; color: var(--muted); }

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.result-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.result-table th:first-child { border-radius: var(--radius) 0 0 0; }
.result-table th:last-child  { border-radius: 0 var(--radius) 0 0; }

.result-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
  vertical-align: top;
  word-break: break-all;
}

.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: rgba(255,255,255,.03); }

.result-table tbody {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ttl-cell  { color: var(--muted); white-space: nowrap; }
.val-cell  { color: var(--text); }
.name-cell { color: var(--muted); }

.no-records { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* ---- Probe cards (ping / traceroute) ---- */

.probe-cards { display: flex; flex-direction: column; gap: 16px; }

.probe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.probe-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.probe-location { font-size: 15px; font-weight: 600; color: var(--text); }
.probe-meta     { font-size: 13px; color: var(--muted); }
.probe-export-btn { margin-left: auto; font-size: 11px; padding: 3px 10px; }
.probe-body     { padding: 12px 14px; }

/* Ping stats */
.ping-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stat-item  { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--mono); font-size: 18px; color: var(--text); }
.stat-value.loss-high { color: var(--error); }
.stat-value.loss-ok   { color: var(--success); }

.ping-rtts { display: flex; gap: 6px; flex-wrap: wrap; }

.rtt-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  color: var(--muted);
}

/* Hop table */
.hop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hop-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.hop-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(48,54,61,.5);
  font-family: var(--mono);
  vertical-align: middle;
}

.hop-table tr:last-child td { border-bottom: none; }
.hop-table tr:hover td { background: rgba(255,255,255,.03); }

.hop-num  { color: var(--muted); width: 32px; text-align: right; }
.hop-host { color: var(--text); }
.hop-ip   { color: var(--muted); }
.hop-rtt  { color: var(--accent); white-space: nowrap; text-align: right; }
.hop-star { color: var(--muted); }

/* ---- IP Lookup ---- */

.ip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 620px;
}

.ip-address {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.ip-section {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.ip-section:last-child { border-bottom: none; }

.ip-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
}

.ip-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  min-width: 110px;
  flex-shrink: 0;
}

.ip-value {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

/* ---- Footer ---- */

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 12px 24px;
  text-align: center;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ---- Responsive ---- */

@media (max-width: 600px) {
  header { padding: 12px; }
  .brand-name { font-size: 16px; }
  main { padding: 20px 16px; }
  .tab-btn { padding: 8px 12px; font-size: 14px; }
  .ping-stats { gap: 16px; }
}
