:root {
  --bg: #05080f;
  --surface: rgba(14, 20, 34, 0.88);
  --surface-2: #121b2d;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(52, 211, 153, 0.42);
  --text: #f8fafc;
  --muted: #94a3b8;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --red: #f43f5e;
  --red-soft: rgba(244, 63, 94, 0.16);
  --cyan: #38bdf8;
  --radius: 16px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body {
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 65% 42% at 50% -12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(ellipse 40% 34% at 88% 8%, rgba(56, 189, 248, 0.10), transparent 58%),
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 22px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin: 0 -20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5, 8, 15, 0.78);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}
.brand img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 0 18px rgba(16, 185, 129, 0.25); }
.brand-sub { font-size: 0.74rem; color: var(--muted); font-weight: 500; }

nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: 0.89rem; font-weight: 500; transition: color .15s; }
nav a:hover { color: var(--text); }

.hero { padding: 52px 0 28px; text-align: center; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.14);
  color: #34d399;
  font-size: 0.79rem;
  font-weight: 600;
  margin-bottom: 18px;
}
h1 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  letter-spacing: -0.04em;
  line-height: 1.09;
  font-weight: 800;
  max-width: 22ch;
  margin: 0 auto 14px;
  background: linear-gradient(110deg, #ffffff 20%, #a7f3d0 65%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { color: var(--muted); max-width: 60ch; margin: 0 auto 28px; font-size: 1.02rem; }

/* Segmented Tabs */
.tabs {
  display: inline-flex;
  background: rgba(14, 20, 34, 0.9);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 5px;
  gap: 5px;
  margin-bottom: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(56, 189, 248, 0.18));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Main Tool Shell */
.panel {
  background: linear-gradient(180deg, rgba(18, 26, 44, 0.9), rgba(11, 16, 28, 0.95));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 56px rgba(0, 0, 0, 0.45);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 26px;
}
.panel.hidden { display: none; }

.scan-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.input, .select {
  background: rgba(5, 8, 15, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 15px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input { flex: 1 1 320px; font-family: var(--mono); }
.input:focus, .select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16); }
.select { min-width: 162px; cursor: pointer; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 11px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .13s, box-shadow .18s, background .15s, border-color .15s;
}
.btn-primary {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #031317;
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 14px 32px rgba(16, 185, 129, 0.36); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); background: #17233a; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 8px; }

.demo-row {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.demo-chip {
  background: rgba(5, 8, 15, 0.78);
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.77rem;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.demo-chip:hover { color: #ffffff; border-color: var(--cyan); background: rgba(56, 189, 248, 0.12); }

/* Result Dashboard */
.result-area { margin-top: 22px; }
.result-area.hidden { display: none; }

.score-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px;
  background: rgba(18, 27, 45, 0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
@media (max-width: 700px) { .score-header { grid-template-columns: 1fr; text-align: left; } }

.score-ring {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 800;
  border: 4px solid var(--green);
  background: var(--bg);
}
.score-safe { border-color: var(--green); color: #34d399; box-shadow: 0 0 24px rgba(16, 185, 129, 0.25); }
.score-caution { border-color: var(--amber); color: #fbbf24; box-shadow: 0 0 24px rgba(245, 158, 11, 0.22); }
.score-danger { border-color: var(--red); color: #fb7185; box-shadow: 0 0 24px rgba(244, 63, 94, 0.28); }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.meta-box {
  background: rgba(5, 8, 15, 0.78);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.meta-label { font-size: 0.71rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.meta-val { font-size: 1.04rem; font-weight: 750; margin-top: 3px; }

.finding {
  padding: 14px 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background: rgba(5, 8, 15, 0.75);
}
.finding-high { border-color: rgba(244, 63, 94, 0.48); background: rgba(244, 63, 94, 0.08); }
.finding-medium, .finding-warn { border-color: rgba(245, 158, 11, 0.42); background: rgba(245, 158, 11, 0.08); }
.finding-low { border-color: rgba(56, 189, 248, 0.38); background: rgba(56, 189, 248, 0.07); }
.finding-pass { border-color: rgba(16, 185, 129, 0.42); background: rgba(16, 185, 129, 0.08); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}
.b-high { background: var(--red-soft); color: #fb7185; }
.b-medium, .b-warn { background: var(--amber-soft); color: #fbbf24; }
.b-low { background: rgba(56, 189, 248, 0.16); color: var(--cyan); }
.b-pass { background: var(--green-soft); color: #34d399; }

.sub-block { margin-top: 18px; }
.sub-block h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 10px; font-weight: 700; }

/* Address Poisoning Visual Diff */
.poison-card {
  background: rgba(5, 8, 15, 0.86);
  border: 1px solid rgba(244, 63, 94, 0.42);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
}
.addr-line {
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 5px;
}
.hl-match { background: rgba(245, 158, 11, 0.3); color: #fde68a; border-radius: 4px; padding: 1px 3px; font-weight: 700; }
.hl-diff { color: #fb7185; font-weight: 700; }
.hl-ok { color: #34d399; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid rgba(148, 163, 184, 0.1); }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); }

/* Diff Tool */
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 720px) { .diff-grid { grid-template-columns: 1fr; } }
.field-label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; font-weight: 650; }

/* Pro / USDC Section */
.pro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; margin-top: 14px; }
.pro-card {
  background: linear-gradient(180deg, rgba(18, 26, 44, 0.82), rgba(11, 16, 28, 0.92));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 22px;
}
.pro-card.highlight {
  border-color: rgba(16, 185, 129, 0.48);
  box-shadow: inset 0 1px 0 rgba(52, 211, 153, 0.18), 0 0 32px rgba(16, 185, 129, 0.08);
}
.pro-card h3 { font-size: 1.06rem; margin-bottom: 6px; font-weight: 700; }
.pro-price { font-size: 1.48rem; font-weight: 800; margin: 6px 0 12px; }
.pro-list { list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: 0.87rem; color: var(--muted); margin-bottom: 16px; }
.pro-list li::before { content: "✓ "; color: var(--green); font-weight: 700; }

footer {
  border-top: 1px solid var(--border);
  margin-top: 34px;
  padding: 26px 0 42px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }
