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

:root {
  --bg: #08080d;
  --bg-card: #111119;
  --bg-input: #0c0c13;
  --bg-hover: #16161f;
  --border: #1c1c2c;
  --border-focus: #5b5bd6;
  --text: #e4e4ef;
  --text-dim: #6e6e8a;
  --text-muted: #3e3e55;
  --accent: #5b5bd6;
  --accent-glow: rgba(91, 91, 214, 0.12);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.08);
  --green-border: rgba(52, 211, 153, 0.2);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.08);
  --red-border: rgba(248, 113, 113, 0.2);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.08);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 17px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.nav-section { flex: 1; }

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 8px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.nav-item:hover { color: var(--text); background: var(--bg-hover); }

.nav-item.active {
  color: #fff;
  background: var(--accent);
}

.sidebar-footer {
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-credit {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s;
}

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

/* ---------- main ---------- */
.main {
  flex: 1;
  padding: 32px 40px 60px;
  max-width: 960px;
}

.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text-dim); font-size: 14px; }

/* ---------- panels ---------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

/* ---------- form inputs ---------- */
.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.input-header label, .input-field label {
  font-size: 13px;
  font-weight: 600;
}

.input-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; }
.sep { opacity: 0.3; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  transition: border-color 0.2s;
}

textarea { height: 180px; resize: vertical; }

textarea:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea::placeholder, input::placeholder { color: var(--text-muted); }

.input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.input-field { display: flex; flex-direction: column; gap: 6px; }
.input-field.grow { flex: 1; }

select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.control-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm { padding: 6px 14px; font-size: 12px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d6de0; box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-group { display: flex; gap: 6px; }

/* ---------- progress ---------- */
.progress-wrap { margin-bottom: 16px; animation: fadeIn 0.2s; }
.progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.progress-fill.anim { width: 100%; animation: indeterminate 1.5s ease-in-out infinite; }

@keyframes indeterminate {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ---------- summary cards ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s;
}

.summary-3 { grid-template-columns: repeat(3, 1fr); }
.summary-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.stat-val { font-size: 22px; font-weight: 700; margin-bottom: 3px; }
.stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }

.card-green .stat-val { color: var(--green); }
.card-red .stat-val { color: var(--red); }
.card-yellow .stat-val { color: var(--yellow); }
.card-blue .stat-val { color: var(--blue); }

/* ---------- toolbar / filters ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
  animation: fadeIn 0.3s;
}

.filter-group { display: flex; gap: 4px; }

.filter-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s;
}

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

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  text-align: left;
  padding: 11px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.015); }

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-alive { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-dead { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-open { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-closed { background: rgba(255,255,255,0.03); color: var(--text-muted); border: 1px solid var(--border); }

.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.type-dc { color: var(--yellow); background: var(--yellow-bg); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.type-res { color: var(--green); background: var(--green-bg); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.type-unknown { color: var(--text-muted); }

.latency-fast { color: var(--green); }
.latency-mid { color: var(--yellow); }
.latency-slow { color: var(--red); }

.flag-clean { color: var(--green); }
.flag-detected { color: var(--red); }

/* ---------- IP hero ---------- */
.ip-hero {
  text-align: center;
  padding: 30px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: fadeIn 0.3s;
}

.ip-address {
  font-size: 32px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  margin-bottom: 6px;
}

.ip-location {
  font-size: 15px;
  color: var(--text-dim);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeIn 0.3s;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-card);
  font-size: 13px;
}

.info-item .dim { font-size: 11px; }

/* ---------- ping ---------- */
.ping-stats {
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.ping-row { display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 600; }
.ping-row .dim { font-size: 11px; font-weight: 400; }

.raw-output {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 8px;
}

/* ---------- audit page ---------- */
.audit-score-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: fadeIn 0.3s;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.score-circle.score-easy { border-color: var(--green); }
.score-circle.score-moderate { border-color: var(--yellow); }
.score-circle.score-hard { border-color: #f97316; }
.score-circle.score-vhard { border-color: var(--red); }

.score-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.score-circle.score-easy .score-num { color: var(--green); }
.score-circle.score-moderate .score-num { color: var(--yellow); }
.score-circle.score-hard .score-num { color: #f97316; }
.score-circle.score-vhard .score-num { color: var(--red); }

.score-of {
  font-size: 11px;
  color: var(--text-dim);
}

.score-meta { flex: 1; }

.score-verdict {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.score-url {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 4px;
}

.score-latency { font-size: 12px; }

.audit-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s;
}

.audit-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.audit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.audit-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.audit-tag-high {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.audit-tag-medium {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.audit-tag-none {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.audit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-list li {
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.audit-list li:last-child { border-bottom: none; }

.audit-list li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--yellow);
  margin-top: 7px;
  flex-shrink: 0;
}

.audit-details { margin-bottom: 12px; }

.audit-headers {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-header-row {
  display: flex;
  gap: 12px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.audit-header-row:last-child { border-bottom: none; }

.audit-header-name {
  color: var(--accent);
  min-width: 220px;
  flex-shrink: 0;
}

.audit-header-val {
  color: var(--text-dim);
  word-break: break-all;
}

.audit-chain {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-chain-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.chain-status {
  background: var(--yellow-bg);
  color: var(--yellow);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.chain-arrow { color: var(--text-muted); }

.chain-url {
  color: var(--text-dim);
  word-break: break-all;
}

@media (max-width: 768px) {
  .audit-score-hero { flex-direction: column; text-align: center; }
  .audit-header-name { min-width: 140px; }
}

/* ---------- SSL hero ---------- */
.ssl-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: fadeIn 0.3s;
}

.ssl-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.ssl-icon.ssl-ok {
  background: var(--green-bg);
  border: 2px solid var(--green-border);
}

.ssl-icon.ssl-warn {
  background: var(--yellow-bg);
  border: 2px solid rgba(251, 191, 36, 0.2);
}

.ssl-icon.ssl-bad {
  background: var(--red-bg);
  border: 2px solid var(--red-border);
}

.ssl-subject { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.ssl-issuer { font-size: 13px; }

/* DNS record blocks */
.dns-record-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  animation: fadeIn 0.3s;
}

.dns-record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.dns-record-type {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

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

.dns-record-values {
  padding: 8px 16px;
}

.dns-record-row {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  word-break: break-all;
}

.dns-record-row:last-child { border-bottom: none; }

.dns-mx-priority {
  color: var(--text-dim);
  font-size: 11px;
}

/* SSL chain */
.ssl-chain-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.ssl-chain-item:last-child { border-bottom: none; }

.ssl-chain-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ssl-chain-detail { flex: 1; }
.ssl-chain-subject { font-weight: 600; margin-bottom: 2px; }
.ssl-chain-issuer { font-size: 12px; color: var(--text-dim); }

/* ---------- drop zone ---------- */
.drop-zone {
  position: relative;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(91, 91, 214, 0.08);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  z-index: 10;
  pointer-events: none;
}

.drop-zone.dragover textarea {
  border-color: var(--accent);
}

/* ---------- proxy sources ---------- */
.proxy-sources {
  margin-top: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.proxy-sources a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.proxy-sources a:hover {
  color: #8080e0;
  text-decoration: underline;
}

/* ---------- utils ---------- */
.dim { color: var(--text-dim); }
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--green-border);
  color: var(--green);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  animation: toastIn 0.2s, toastOut 0.2s 1.8s forwards;
}

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---------- mobile header ---------- */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

.sidebar-overlay.visible {
  display: block;
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 200;
    transition: left 0.25s ease;
    height: 100vh;
    width: 240px;
    min-width: 240px;
  }

  .sidebar.open {
    left: 0;
  }

  .main { padding: 20px 16px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .input-row { flex-direction: column; }
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/* Target Check NEW badge */
.nav-badge {
  background: #10b981;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
  letter-spacing: 0.5px;
}
.page-badge {
  background: #10b981;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
#tc-url {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input, #0f1419);
  border: 1px solid var(--border, #1f2937);
  border-radius: 6px;
  color: var(--text, #e5e7eb);
  font-family: inherit;
  font-size: 14px;
}
#tc-url:focus {
  outline: none;
  border-color: var(--accent, #3b82f6);
}
#tc-proxies {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  background: var(--bg-input, #0f1419);
  border: 1px solid var(--border, #1f2937);
  border-radius: 6px;
  color: var(--text, #e5e7eb);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}
#tc-proxies:focus {
  outline: none;
  border-color: var(--accent, #3b82f6);
}
