:root {
  --bg: #0b0d11;
  --bg-2: #12151c;
  --surface: #171b24;
  --surface-2: #1e2430;
  --border: #2c3342;
  --text: #e9edf4;
  --muted: #9aa3b5;
  --faint: #6d7688;
  --green: #3dd68c;
  --green-bg: rgba(61, 214, 140, 0.12);
  --yellow: #f0c14a;
  --yellow-bg: rgba(240, 193, 74, 0.12);
  --red: #ff5d6c;
  --red-bg: rgba(255, 93, 108, 0.12);
  --blue: #7aa2ff;
  --blue-bg: rgba(122, 162, 255, 0.12);
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.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;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
}

.top { margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.logo {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px;
  background:
    conic-gradient(from 210deg, var(--blue), var(--green), var(--yellow), var(--blue));
  mask: radial-gradient(circle at 50% 50%, transparent 0 8px, #000 9px);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 0 8px, #000 9px);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08);
}
.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.tagline { margin: 0; color: var(--muted); font-size: 0.86rem; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 12px;
  min-height: 44px;
  font-weight: 600;
}
.tab.is-on {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow);
}

.search-row, .scan-head { display: flex; flex-direction: column; gap: 10px; }
.search-row { margin-bottom: 8px; }
#mint-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px;
  min-height: 48px;
  outline: none;
}
#mint-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.primary {
  border: 0;
  background: var(--blue);
  color: #0b0d11;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 48px;
}
.primary:disabled { opacity: 0.55; cursor: default; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 0.86rem; }

.status {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
}
.status.err { border-color: var(--red); color: var(--text); background: var(--red-bg); }
.status.warn { border-color: var(--yellow); background: var(--yellow-bg); color: var(--text); }

.token-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 14px;
}
.token-head img, .thumb-fallback {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  object-fit: cover;
  flex: 0 0 52px;
}
.token-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.02em; }
.token-head .meta { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; word-break: break-all; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.badge.chase { color: var(--red); background: var(--red-bg); border-color: transparent; }
.badge.pull { color: var(--green); background: var(--green-bg); border-color: transparent; }
.badge.high { color: var(--red); background: var(--red-bg); border-color: transparent; }
.badge.caution { color: var(--yellow); background: var(--yellow-bg); border-color: transparent; }
.badge.fewer { color: var(--green); background: var(--green-bg); border-color: transparent; }

.verdict {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
}
.verdict h3 { margin: 0 0 4px; font-size: 1.05rem; }
.verdict p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.verdict.high { background: var(--red-bg); border-color: rgba(255, 93, 108, 0.35); }
.verdict.caution { background: var(--yellow-bg); border-color: rgba(240, 193, 74, 0.35); }
.verdict.fewer { background: var(--green-bg); border-color: rgba(61, 214, 140, 0.35); }
.verdict.unknown { background: var(--surface); }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat .k { display: block; color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat .v { display: block; margin-top: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v.up { color: var(--green); }
.stat .v.down { color: var(--red); }

.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}
th, td { padding: 9px 10px; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--faint); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
td { border-top: 1px solid var(--border); }
td.up { color: var(--green); }
td.down { color: var(--red); }

.section-title {
  margin: 8px 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  font-weight: 700;
}

.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.check {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 12px 14px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px 10px;
  align-items: start;
}
.check .dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin-top: 5px;
  background: var(--faint);
}
.check.green .dot { background: var(--green); }
.check.yellow .dot { background: var(--yellow); }
.check.red .dot { background: var(--red); }
.check .title { font-weight: 700; font-size: 0.95rem; }
.check .why { grid-column: 2 / 3; color: var(--muted); font-size: 0.88rem; }
.check .flag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface-2);
}
.check.green .flag { color: var(--green); background: var(--green-bg); }
.check.yellow .flag { color: var(--yellow); background: var(--yellow-bg); }
.check.red .flag { color: var(--red); background: var(--red-bg); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 20px;
}
.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.links a:hover { border-color: var(--blue); text-decoration: none; }

.scan-list { display: flex; flex-direction: column; gap: 10px; }
.scan-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
}
.scan-card:hover, .scan-card:focus { border-color: var(--blue); outline: none; }
.scan-card .row1 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.scan-card h3 { margin: 0; font-size: 1.05rem; }
.scan-card .sub { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.scan-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.scan-metrics div { background: var(--bg-2); border-radius: 10px; padding: 8px; }
.scan-metrics .k { display: block; color: var(--faint); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.scan-metrics .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.scan-card .why { margin: 10px 0 0; color: var(--muted); font-size: 0.86rem; }
.scan-card .card-links { margin-top: 10px; }

.foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}
.foot p { margin: 0 0 8px; }
.sources { color: var(--faint); }

.loading { display: flex; align-items: center; gap: 10px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .search-row { flex-direction: row; align-items: stretch; }
  #mint-input { flex: 1; }
  .primary { width: auto; padding-inline: 22px; }
}
