:root {
  --bg: #0a0b0d;
  --panel: #131519;
  --panel-2: #17191e;
  --border: #22252b;
  --border-soft: #1a1c21;
  --text: #e8e9eb;
  --muted: #8a8f98;
  --muted-2: #5c6169;
  --green: #3dd68c;
  --amber: #f5a623;
  --red: #e5484d;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

code {
  font-family: var(--mono);
  background: var(--panel-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--text);
}

/* ---------- topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  position: relative;
  width: 22px;
  height: 18px;
  display: inline-block;
}
.brand-mark .node {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
}
.brand-mark .n1 { left: 0; top: 6px; background: var(--green); }
.brand-mark .n2 { right: 0; top: 0; }
.brand-mark .n3 { right: 0; bottom: 0; }
.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topbar-link {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
}
.topbar-link:hover { color: var(--text); border-color: var(--muted-2); }

main { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* ---------- intro ---------- */
.intro { padding: 64px 0 40px; transition: opacity 0.3s ease; }
.intro.collapsed { display: none; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 14px;
}

.intro h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 18px;
}

.lede {
  color: var(--muted);
  font-size: 16px;
  max-width: 62ch;
  margin: 0 0 32px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 620px) {
  .info-grid { grid-template-columns: 1fr; }
}
.info-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.info-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 8px;
}
.info-body {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(61, 214, 140, 0.06);
  border: 1px solid rgba(61, 214, 140, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  color: #b9e8d0;
  margin-bottom: 28px;
}
.privacy-banner svg { flex-shrink: 0; margin-top: 2px; }

.run-row { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }

.run-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.run-btn:hover { transform: translateY(-1px); }
.run-btn:active { transform: translateY(0); }
.run-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.fast-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.fast-toggle input { display: none; }
.switch {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted-2);
  top: 2px;
  left: 2px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.fast-toggle input:checked + .switch { background: rgba(61, 214, 140, 0.25); }
.fast-toggle input:checked + .switch::after {
  transform: translateX(14px);
  background: var(--green);
}

/* ---------- terminal shell ---------- */
.shell {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 32px 0;
  background: #0d0e11;
}
.shell.visible { display: block; }

.shell-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}
.shell-dots { display: flex; gap: 6px; }
.shell-dots .dot { width: 10px; height: 10px; border-radius: 50%; }
.shell-dots .red { background: var(--red); }
.shell-dots .amber { background: var(--amber); }
.shell-dots .green { background: var(--green); }
.shell-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.shell-live {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
}

.log {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  padding: 18px 20px;
  max-height: 320px;
  overflow-y: auto;
  color: #c7cad0;
}
.log-row { white-space: pre-wrap; word-break: break-word; }
.log-tag { color: var(--muted-2); margin-right: 4px; }

.grid-wrap { display: none; padding: 4px 20px 20px; border-top: 1px solid var(--border-soft); }
.grid-wrap.visible { display: block; }
.grid-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin: 16px 0 10px;
}
.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10px, 1fr));
  gap: 3px;
}
.host-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--border-soft);
}
.host-cell.pending { background: var(--border); animation: pulse 1s ease-in-out infinite; }
.host-cell.up { background: var(--green); }
.host-cell.down { background: var(--border-soft); }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.9; } }

.grid-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}
.grid-legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.lg-up { background: var(--green); }
.lg-down { background: var(--border-soft); border: 1px solid var(--border); }
.lg-pending { background: var(--border); }

/* ---------- results ---------- */
.results { display: none; padding: 8px 0 60px; scroll-margin-top: 76px; }
.results.visible { display: block; }

.results h2 {
  font-size: clamp(24px, 4vw, 30px);
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

.summary-line {
  color: var(--muted);
  font-size: 15px;
  max-width: 68ch;
  margin: 0 0 28px;
}

.fact-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 700px) {
  .fact-row { grid-template-columns: 1fr 1fr; }
}
.fact {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.fact-label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin: 0 0 6px;
}
.fact-value {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  word-break: break-word;
}
.mono { font-family: var(--mono); font-weight: 500; }

.mdns-note {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 166, 35, 0.06);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: #f0d6a8;
  margin-bottom: 24px;
}
.dot-info {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  color: #1a1300;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.port-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.port-panel-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border-soft); }
.port-panel-title { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.port-panel-sub { font-size: 12.5px; color: var(--muted); margin: 0; }

.port-header-row,
.port-row {
  display: grid;
  grid-template-columns: 20px 56px 1fr 84px 84px;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
}
.port-header-row {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  padding-top: 12px;
  padding-bottom: 8px;
}
.port-row { border-top: 1px solid var(--border-soft); }
.port-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.port-row.status-open .dot { background: var(--green); }
.port-row.status-filtered .dot { background: var(--amber); }
.port-row.status-closed .dot { background: var(--muted-2); opacity: 0.5; }
.port-num { font-family: var(--mono); color: var(--muted); }
.port-service { color: var(--text); }
.port-status {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
}
.status-open .port-status { color: var(--green); }
.status-filtered .port-status { color: var(--amber); }
.status-closed .port-status { color: var(--muted-2); }
.port-conf { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }

@media (max-width: 620px) {
  .port-header-row, .port-row {
    grid-template-columns: 14px 44px 1fr 70px;
  }
  .port-conf { display: none; }
}

.closing-note {
  font-size: 13px;
  color: var(--muted-2);
  max-width: 68ch;
  line-height: 1.6;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 24px;
  text-align: center;
}
.footer p {
  color: var(--muted-2);
  font-size: 12.5px;
  margin: 0;
}

/* ---------- accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .host-cell.pending { animation: none; }
  .run-btn { transition: none; }
}
