:root {
  --bg: #05070a;
  --panel: #0d1016;
  --panel-2: #10141c;
  --panel-border: #1d2330;
  --text: #e8ecf3;
  --text-dim: #7c869c;
  --accent: #4ee6a6;
  --accent-dim: #2f9c72;
  --cyan: #4ecde6;
  --danger: #e6584e;
  --warn: #e6b84e;
  --mono: "SF Mono", "Consolas", "Menlo", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-mark-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark {
  font-size: 22px;
  color: var(--accent);
  background: rgba(78, 230, 166, 0.1);
  border: 1px solid rgba(78, 230, 166, 0.35);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  z-index: 1;
}

.pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 1px solid rgba(78, 230, 166, 0.4);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

.subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.status-orb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 7px 14px;
  border-radius: 100px;
}

.orb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.2s;
}

.status-orb.active .orb-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: blink 1s ease-in-out infinite;
}

.status-orb.error .orb-dot { background: var(--danger); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- globe stage ---------- */

.globe-stage {
  position: relative;
  height: 220px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: radial-gradient(circle at 50% 40%, #0f1a16 0%, var(--panel) 70%);
  overflow: hidden;
  margin-bottom: 20px;
}

#globeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.globe-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 42px;
  flex-wrap: wrap;
  pointer-events: none;
}

.globe-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(78, 230, 166, 0.4);
}

.stat-num.warn {
  color: var(--warn);
  text-shadow: 0 0 18px rgba(230, 184, 78, 0.4);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .globe-overlay { gap: 24px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 20px;
}

.panel-title {
  font-size: 11.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 14px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}

#domain, textarea {
  width: 100%;
  background: #080a0f;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

#domain:focus, textarea:focus {
  border-color: var(--accent-dim);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

button {
  border: none;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

button:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #04140c;
  flex: 1;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
}

.btn-secondary:hover { border-color: var(--accent-dim); }

.status-line {
  font-size: 12.5px;
  color: var(--text-dim);
  min-height: 18px;
  margin: 4px 0 0;
}

.progress-wrap { margin-top: 10px; }

.progress-bar {
  height: 6px;
  background: #080a0f;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 11.5px;
  color: var(--text-dim);
  display: block;
  margin-top: 5px;
}

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

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.results-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.count-badge {
  background: rgba(78, 230, 166, 0.12);
  color: var(--accent);
  border: 1px solid rgba(78, 230, 166, 0.3);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--mono);
}

.table-wrap {
  overflow-x: auto;
  max-height: 560px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  background: #080a0f;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--panel-border);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #161a24;
  vertical-align: top;
}

tbody tr:hover { background: rgba(255,255,255,0.02); }

tbody tr.row-takeover {
  background: rgba(230, 88, 78, 0.06);
}

tbody tr.row-wildcard {
  opacity: 0.55;
}

.host-cell {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
}

.wildcard-tag {
  display: block;
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-top: 2px;
}

.ip-cell {
  font-family: var(--mono);
  color: var(--text-dim);
  font-size: 12px;
}

.http-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 5px;
  margin: 1px 3px 1px 0;
}

.http-2xx { background: rgba(78,230,166,0.15); color: var(--accent); }
.http-3xx { background: rgba(230,184,78,0.15); color: var(--warn); }
.http-4xx, .http-5xx { background: rgba(230,88,78,0.15); color: var(--danger); }

.meta-cell {
  color: var(--text-dim);
  font-size: 12px;
  max-width: 260px;
}

.meta-cell .title-line {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.port-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(230,88,78,0.12);
  color: var(--danger);
  padding: 2px 6px;
  border-radius: 5px;
  margin: 1px 3px 1px 0;
}

.takeover-cell { font-size: 12px; max-width: 220px; }

.takeover-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  margin-bottom: 3px;
}

.takeover-badge.vuln {
  background: rgba(230,88,78,0.18);
  color: var(--danger);
}

.takeover-badge.maybe {
  background: rgba(230,184,78,0.18);
  color: var(--warn);
}

.takeover-reason {
  color: var(--text-dim);
  font-size: 11px;
  display: block;
}

.empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 12px;
  font-size: 13px;
}

.footnote {
  text-align: center;
  color: var(--text-dim);
  font-size: 11.5px;
  margin-top: 24px;
}
