:root {
  color-scheme: dark;
  --bg: #07110c;
  --surface: #0b1811;
  --surface-2: #0f2117;
  --surface-3: #142b1e;
  --line: #234431;
  --line-bright: #35674a;
  --text: #f2fff6;
  --muted: #91a799;
  --green: #38ed89;
  --lime: #b3ff65;
  --amber: #ffc45c;
  --orange: #ff9f43;
  --red: #ff6b73;
  --blue: #7dd3fc;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 88% -10%, rgba(56, 237, 137, 0.16), transparent 34rem),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 48px 48px, 48px 48px, auto;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  padding: 12px max(20px, calc((100vw - 1320px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(101, 170, 124, 0.22);
  background: rgba(7, 17, 12, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(179, 255, 101, 0.32));
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.network-chip, .refresh-button, .alert-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 33, 23, 0.75);
  color: var(--muted);
  font-size: 0.84rem;
}
.network-chip b { color: var(--text); }
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(56, 237, 137, 0.1);
}
.refresh-button {
  cursor: pointer;
  color: #092014;
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--lime));
  font-weight: 800;
}
.alert-button {
  cursor: pointer;
  color: #c9f9d9;
  font-weight: 800;
}
.alert-button:hover { border-color: var(--line-bright); background: var(--surface-3); }
.alert-button.enabled { color: #092014; border-color: transparent; background: var(--green); }
.alert-button.blocked { color: var(--amber); }
.refresh-button:hover { filter: brightness(1.08); }
.refresh-button:disabled { cursor: wait; opacity: 0.68; }

main { width: min(1320px, calc(100% - 40px)); margin: 0 auto; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
  gap: 36px;
  align-items: end;
  padding: 52px 0 30px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.17em;
}
h1, h2, p { margin-top: 0; }
h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 4.6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}
.intro-copy {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.6;
}
.scan-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 24, 17, 0.82);
  box-shadow: var(--shadow);
}
.scan-status strong, .scan-status span { display: block; }
.scan-status strong { margin-bottom: 4px; font-size: 0.95rem; }
.scan-status span { color: var(--muted); font-size: 0.79rem; }
.scan-pulse {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
}
.scan-pulse::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(56, 237, 137, 0.52);
  border-radius: 50%;
  animation: ping 1.6s infinite;
}
.scan-pulse.idle::after { animation: none; opacity: 0; }
@keyframes ping { 0% { transform: scale(0.65); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scan-pulse::after { animation: none; } }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(11, 24, 17, 0.82);
}
.metrics article { min-height: 126px; padding: 22px; border-right: 1px solid var(--line); }
.metrics article:last-child { border-right: 0; }
.metrics span, .metrics small { display: block; color: var(--muted); }
.metrics span { margin-bottom: 8px; font-size: 0.82rem; }
.metrics strong { display: block; margin-bottom: 5px; font-size: 2.15rem; letter-spacing: -0.04em; }
.metrics small { font-size: 0.75rem; line-height: 1.35; }

.radar-panel {
  margin-top: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 20, 13, 0.9);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.panel-head h2, .gate-strip h2 { margin-bottom: 0; font-size: 1.45rem; letter-spacing: -0.025em; }
.threshold-note { display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: 7px; }
.threshold-note span { color: var(--muted); font-size: 0.75rem; }
.threshold-note b {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: #c9f9d9;
  font-size: 0.73rem;
}
.contract-analyzer {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(360px, 1.15fr);
  gap: 16px 24px;
  align-items: center;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(56, 237, 137, 0.26);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 237, 137, 0.08), rgba(12, 32, 20, 0.82));
}
.contract-analyzer .eyebrow { margin-bottom: 4px; }
.contract-analyzer strong { display: block; margin-bottom: 5px; font-size: 0.94rem; }
.contract-analyzer span { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.contract-analyzer form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.contract-analyzer textarea, .contract-analyzer button {
  min-height: 46px;
  border: 1px solid var(--line-bright);
  border-radius: 9px;
}
.contract-analyzer textarea { min-width: 0; padding: 12px 13px; resize: vertical; color: var(--text); background: #07110c; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.45; }
.contract-analyzer textarea::placeholder { color: #6f8476; }
.contract-analyzer button { padding: 0 16px; border-color: transparent; color: #092014; background: var(--green); cursor: pointer; font-weight: 800; }
.contract-analyzer button:disabled { opacity: 0.55; cursor: wait; }
.ca-result { grid-column: 2; min-height: 18px; margin: -7px 0 0; color: var(--muted); font-size: 0.76rem; }
.ca-result.success { color: #a8f7c7; }
.ca-result.error { color: #ffb2b7; }
.controls { display: flex; gap: 10px; margin: 24px 0 20px; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-right: auto; }
.filter, .search-box input, .sort-box select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
}
.filter { padding: 0 13px; cursor: pointer; font-size: 0.82rem; font-weight: 700; }
.filter:hover, .filter.active { border-color: var(--line-bright); color: var(--text); background: var(--surface-3); }
.filter.active { box-shadow: inset 0 -2px var(--green); }
.search-box input { width: 210px; padding: 0 12px; color: var(--text); }
.search-box input::placeholder { color: #6f8476; }
.sort-box select { min-width: 150px; padding: 0 34px 0 12px; }
.source-warning {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 196, 92, 0.35);
  border-radius: 9px;
  color: #ffe1a7;
  background: rgba(255, 196, 92, 0.08);
  font-size: 0.82rem;
  line-height: 1.5;
}

.candidate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.candidate-card {
  position: relative;
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(18, 39, 27, 0.9), rgba(10, 25, 16, 0.94));
  overflow: hidden;
}
.candidate-card.hot-glow {
  border-color: rgba(255, 159, 67, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 159, 67, 0.45),
    0 0 24px rgba(255, 126, 37, 0.38),
    0 0 56px rgba(255, 126, 37, 0.18),
    inset 0 0 22px rgba(255, 159, 67, 0.06);
}
.candidate-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--status-color, var(--muted));
}
.card-top { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.pair-symbols { min-width: 0; }
.pair-symbols strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 1.23rem;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pair-symbols strong span { color: var(--lime); }
.pair-symbols small { display: block; overflow: hidden; color: var(--muted); font-size: 0.77rem; text-overflow: ellipsis; white-space: nowrap; }
.status-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--status-color) 48%, transparent);
  border-radius: 999px;
  color: var(--status-color);
  background: color-mix(in srgb, var(--status-color) 10%, transparent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.card-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 15px; }
.card-metrics div { min-width: 0; }
.card-metrics span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.68rem; }
.card-metrics strong { display: block; overflow: hidden; font-size: 0.91rem; text-overflow: ellipsis; white-space: nowrap; }
.signal-row { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; }
.signal-row span, .signal-row b { font-size: 0.75rem; }
.signal-row span { color: var(--muted); }
.signal-row b { color: var(--text); }
.score-track { height: 6px; overflow: hidden; border-radius: 99px; background: #1c3325; }
.score-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--lime)); }
.risk-tags { min-height: 27px; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.risk-tag {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(145, 167, 153, 0.09);
  color: var(--muted);
  font-size: 0.68rem;
}
.risk-tag.good { color: #a8f7c7; background: rgba(56, 237, 137, 0.09); }
.risk-tag.warn { color: #ffdc9d; background: rgba(255, 196, 92, 0.09); }
.risk-tag.bad { color: #ffb2b7; background: rgba(255, 107, 115, 0.1); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.card-actions button, .card-actions a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  text-decoration: none;
}
.card-actions button:hover, .card-actions a:hover { border-color: var(--line-bright); background: var(--surface-3); }
.card-actions .primary { color: #092014; border-color: transparent; background: var(--green); }
.card-actions .watch-button.active { border-color: rgba(255, 196, 92, 0.48); color: var(--amber); background: rgba(255, 196, 92, 0.09); }
.loading-card {
  height: 272px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state {
  grid-column: 1 / -1;
  padding: 56px 22px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
}
.empty-state strong { display: block; margin-bottom: 8px; font-size: 1rem; }
.empty-state span { color: var(--muted); font-size: 0.86rem; }

.gate-strip {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 36px;
  align-items: center;
  margin: 22px 0 48px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(11, 24, 17, 0.78);
}
.gate-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gate-steps article { display: flex; gap: 10px; align-items: start; }
.gate-steps b {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #092014;
  background: var(--green);
  font-size: 0.74rem;
}
.gate-steps span { color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.gate-steps strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 0.8rem; }

footer {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 34px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}
footer p { margin-bottom: 0; }

dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  color: var(--text);
  background: #0a1710;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.65);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(5px); }
.dialog-shell { position: relative; padding: 28px; }
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 1.4rem;
}
.dialog-head { padding-right: 48px; }
.dialog-head h2 { margin: 5px 0 7px; font-size: 1.65rem; }
.dialog-head p { color: var(--muted); }
.runner-verdict { margin-top: 18px; padding: 14px; border: 1px solid rgba(56, 237, 137, 0.28); border-radius: 10px; background: rgba(56, 237, 137, 0.07); }
.runner-verdict span, .runner-verdict small { display: block; color: var(--muted); }
.runner-verdict span { margin-bottom: 5px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }
.runner-verdict strong { display: block; margin-bottom: 4px; color: var(--lime); font-size: 1rem; }
.runner-verdict small { font-size: 0.75rem; line-height: 1.45; }
.detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.detail-metrics div, .check-item { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.detail-metrics span, .address-row span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.7rem; }
.detail-metrics strong { font-size: 0.92rem; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0 22px; }
.check-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.77rem; }
.check-item b.pass { color: var(--green); }
.check-item b.fail { color: var(--red); }
.check-item b.pending { color: var(--amber); }
.security-note { margin: -10px 0 22px; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.address-list { display: grid; gap: 9px; }
.address-row { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #07110c; }
.address-row code { display: block; overflow-wrap: anywhere; color: #cbf8da; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; line-height: 1.55; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.dialog-actions a, .dialog-actions button { min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 750; text-decoration: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 11px 14px;
  border: 1px solid var(--line-bright);
  border-radius: 9px;
  color: var(--text);
  background: #10261a;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
  font-size: 0.8rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 940px) {
  .intro { grid-template-columns: 1fr; }
  .scan-status { max-width: 520px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .controls { flex-wrap: wrap; }
  .contract-analyzer { grid-template-columns: 1fr; }
  .ca-result { grid-column: 1; }
  .filter-tabs { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .gate-strip { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { align-items: stretch; padding: 10px 16px; }
  .brand { font-size: 0.78rem; }
  .network-chip { display: none; }
  .refresh-button, .alert-button { padding: 0 10px; font-size: 0.76rem; }
  .alert-button span { display: none; }
  main { width: min(100% - 24px, 1320px); }
  .intro { padding-top: 36px; }
  h1 { font-size: clamp(2.2rem, 12vw, 3.25rem); }
  .metrics article { min-height: 110px; padding: 17px; }
  .metrics strong { font-size: 1.7rem; }
  .radar-panel { padding: 17px; }
  .panel-head { display: block; }
  .threshold-note { justify-content: start; margin-top: 14px; }
  .contract-analyzer { padding: 15px; }
  .contract-analyzer form { grid-template-columns: 1fr; }
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .filter { white-space: nowrap; }
  .sort-box, .sort-box select { width: 100%; }
  .candidate-grid { grid-template-columns: 1fr; }
  .card-metrics { grid-template-columns: repeat(2, 1fr); row-gap: 13px; }
  .gate-steps { grid-template-columns: 1fr; }
  footer { width: calc(100% - 24px); display: block; }
  footer p + p { margin-top: 8px; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .dialog-shell { padding: 22px 17px; }
}
