:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #18181b;
  --accent-fg: #fafafa;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --emerald: #047857;
  --emerald-hover: #059669;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --violet-border: rgba(124, 58, 237, 0.25);
  --violet-text: #5b21b6;
  --input: #ffffff;
  --log-bg: #f4f4f5;
  --radius-xl: 1.5rem;
  --radius-lg: 1rem;
  --radius: 0.5rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --panel: #18181b;
    --border: #27272a;
    --text: #fafafa;
    --muted: #a1a1aa;
    --accent: #fafafa;
    --accent-fg: #18181b;
    --emerald: #10b981;
    --emerald-hover: #34d399;
    --violet-soft: rgba(124, 58, 237, 0.15);
    --violet-border: rgba(124, 58, 237, 0.35);
    --violet-text: #c4b5fd;
    --input: #09090b;
    --log-bg: #0d1117;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.1rem 1.6rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

@media (min-width: 640px) {
  .hero {
    padding: 3rem 2.5rem;
  }
}

.hero-glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at top right, rgba(124, 58, 237, 0.12), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(16, 185, 129, 0.08), transparent 50%);
}

.hero-orb {
  pointer-events: none;
  position: absolute;
  right: -5rem;
  top: -5rem;
  width: 16rem;
  height: 16rem;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.1);
  filter: blur(48px);
}

.hero-mark {
  pointer-events: none;
  position: relative;
  z-index: 1;
  display: block;
  width: 8.5rem;
  height: 8.5rem;
  margin: 0 auto 1rem;
  object-fit: contain;
  user-select: none;
}

@media (min-width: 640px) {
  .hero-mark {
    width: 10rem;
    height: 10rem;
  }
}

@media (min-width: 1024px) {
  .hero-mark {
    position: absolute;
    right: 2.5rem;
    top: 50%;
    width: 14rem;
    height: 14rem;
    margin: 0;
    transform: translateY(-50%);
  }
}

@media (min-width: 1200px) {
  .hero-mark {
    right: 3.5rem;
  }
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.hero-copy .lede {
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1024px) {
  .hero-copy {
    align-items: flex-start;
    margin-left: 0;
    margin-right: 0;
    text-align: left;
  }

  .hero-copy .lede {
    margin-left: 0;
    margin-right: 0;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--violet-border);
  background: var(--violet-soft);
  color: var(--violet-text);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 11px;
  font-weight: 600;
}

.pill-dot {
  position: relative;
  display: flex;
  width: 0.5rem;
  height: 0.5rem;
}

.pill-ping {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #34d399;
  opacity: 0.6;
  animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.pill-core {
  position: relative;
  display: inline-flex;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #10b981;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill-ping {
    animation: none;
    opacity: 0;
  }
}

.hero h1 {
  margin: 1rem 0 0;
  max-width: 48rem;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.grad {
  background: linear-gradient(90deg, #6d28d9, #8b5cf6, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (prefers-color-scheme: dark) {
  .grad {
    background: linear-gradient(90deg, #c4b5fd, #ddd6fe, #6ee7b7);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.lede {
  margin: 1rem 0 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 1rem;
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

@media (min-width: 640px) {
  .card {
    padding: 1.35rem 1.4rem;
  }
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  margin-bottom: 1rem;
}

.card-head-lookup {
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.card-head h2,
h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.card-head p {
  margin: 0;
  flex: 1 1 12rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.mode-toggle {
  display: inline-flex;
  flex-shrink: 0;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 16%, var(--panel));
}

.mode-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn:hover:not(:disabled) {
  color: var(--text);
}

.mode-btn.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--violet-border);
}

.mode-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.field {
  margin-bottom: 0.9rem;
  flex: 1;
  min-width: 220px;
}

.row {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.row .field {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--input);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--mono);
}

input:focus,
select:focus {
  outline: 2px solid rgba(16, 185, 129, 0.35);
  border-color: #10b981;
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.hint code,
.card-head code {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.actions,
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--emerald);
  color: #fff;
  box-shadow: 0 1px 2px rgba(4, 120, 87, 0.25);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #18181b;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.25);
  }
}

.btn-primary:hover:not(:disabled) {
  background: var(--emerald-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--border) 35%, var(--panel));
}

.btn-violet {
  background: var(--violet-soft);
  color: var(--violet-text);
  border-color: var(--violet-border);
}

.btn-violet:hover:not(:disabled) {
  border-color: rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.16);
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.progress {
  height: 0.45rem;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #10b981);
  transition: width 0.2s ease;
}

.log {
  margin: 0;
  max-height: 11rem;
  overflow: auto;
  padding: 0.75rem 0.85rem;
  border-radius: 0.65rem;
  background: var(--log-bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: pre-wrap;
}

.results {
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* [hidden] loses to display:flex without this */
.results[hidden],
.status[hidden] {
  display: none !important;
}

.results:not([hidden]) {
  display: flex;
}

.results > .card {
  margin-bottom: 0;
}

.download-section {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.eyebrow {
  margin: 0;
  color: var(--violet-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--violet-border);
  background: var(--violet-soft);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--violet-text);
}

.summary-panel {
  position: relative;
  margin-bottom: 0;
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 0.9rem;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(124, 58, 237, 0.55), rgba(16, 185, 129, 0.45)) border-box;
  border-color: transparent;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    inset 0 1px 0 rgba(124, 58, 237, 0.08),
    0 0 0 1px rgba(16, 185, 129, 0.06);
  overflow: hidden;
}

.summary-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.07), transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(16, 185, 129, 0.06), transparent 45%);
}

.summary-panel .identity,
.summary-panel .kpi-grid {
  position: relative;
  z-index: 1;
}

.identity {
  padding: 0;
}

.identity-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.identity-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}

.identity-item + .identity-item {
  border-top: 1px solid var(--border);
}

.identity-item .label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.identity-item .value {
  min-width: 0;
  margin-left: auto;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: break-all;
}

.identity-item.issuer .value {
  display: block;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  word-break: normal;
  text-align: right;
}

.identity-item .value-strong {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
}

.identity-item.collection .value-strong {
  font-size: 0.95rem;
}

@media (min-width: 720px) {
  .identity-item {
    align-items: baseline;
    min-height: 0;
    padding: 0.9rem 1.05rem;
  }

  .identity-item .value-strong {
    font-size: 1.05rem;
  }

  .identity-item.collection .value-strong {
    font-size: 1.1rem;
  }
}

@media (min-width: 720px) {
  .identity-grid.has-collection {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: baseline;
    gap: 0;
    padding: 0;
  }

  .identity-grid.has-collection .identity-item {
    width: 100%;
    min-width: 0;
    padding: 0.9rem 1.05rem;
    margin: 0;
    border-top: none;
  }

  .identity-grid.has-collection .identity-item.issuer {
    flex-wrap: nowrap;
  }

  .identity-grid.has-collection .identity-item + .identity-item {
    border-left: 1px solid var(--border);
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

@media (min-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.kpi {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.05rem;
}

.kpi + .kpi {
  border-top: 1px solid var(--border);
}

@media (min-width: 720px) {
  .kpi + .kpi {
    border-top: none;
    border-left: 1px solid var(--border);
  }
}

.kpi .label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.kpi .value {
  margin-left: auto;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
}

.panel-head {
  margin-bottom: 0.95rem;
}

.panel-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.download-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 860px) {
  .download-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.download-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  min-height: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--border) 12%, var(--panel));
  box-shadow: inset 0 1px 0 rgba(16, 185, 129, 0.08);
}

.download-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.download-copy h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.download-copy p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.download-copy code {
  font-family: var(--mono);
  font-size: 0.76rem;
}

.file-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 18%, var(--panel));
  padding: 0.12rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.download-card .btn {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: color-mix(in srgb, var(--border) 28%, var(--panel));
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--border) 18%, transparent);
}

td.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.addr-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  vertical-align: middle;
}

footer {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

footer p {
  margin: 0;
  max-width: 48rem;
}

footer a {
  color: var(--violet-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.error-text {
  color: var(--bad);
}

@media (max-width: 640px) {
  .page {
    padding: 0.75rem 0.9rem 3rem;
  }

  .hero h1 {
    font-size: 1.55rem;
  }

  .lede {
    font-size: 0.9rem;
  }

  .row {
    flex-direction: column;
  }

  .row .field {
    min-width: 0;
  }

  .download-card {
    padding: 0.9rem;
  }

  .actions .btn {
    flex: 1 1 auto;
  }

  .table-wrap {
    margin: 0 -0.15rem;
  }

  #holdersTable {
    font-size: 0.82rem;
  }

  #holdersTable .mono {
    font-size: 0.72rem;
  }
}
