:root {
  color-scheme: dark;
  --bg: #0a0612;
  --card: rgba(255, 255, 255, 0.045);
  --card-hi: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f2fc;
  --mute: #a9a1c2;
  --faint: #6f6788;
  --brand: #8b5cf6;
  --brand-hi: #a78bfa;
  --brand-lo: #5b21b6;
  --live: #34d399;
  --warn: #fbbf24;
  --glow-a: rgba(124, 58, 237, 0.55);
  --glow-b: rgba(59, 130, 246, 0.28);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f3ff;
    --card: rgba(255, 255, 255, 0.72);
    --card-hi: rgba(255, 255, 255, 0.95);
    --line: rgba(60, 30, 120, 0.13);
    --text: #1a1033;
    --mute: #5d5478;
    --faint: #8a82a3;
    --brand: #7c3aed;
    --brand-hi: #6d28d9;
    --brand-lo: #4c1d95;
    --live: #059669;
    --warn: #b45309;
    --glow-a: rgba(167, 139, 250, 0.55);
    --glow-b: rgba(96, 165, 250, 0.3);
    --shadow: 0 24px 60px -30px rgba(76, 29, 149, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; }

/* A slow aurora behind everything: two soft blobs, the page's only decoration. */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.9; will-change: transform; }
.aurora i:nth-child(1) { width: 52vmax; height: 52vmax; left: -14vmax; top: -22vmax; background: radial-gradient(closest-side, var(--glow-a), transparent); animation: drift 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 46vmax; height: 46vmax; right: -16vmax; bottom: -20vmax; background: radial-gradient(closest-side, var(--glow-b), transparent); animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate3d(5vmax, 4vmax, 0) scale(1.08); } }

.page {
  min-height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 28px) clamp(16px, 3vw, 36px) clamp(12px, 1.6vw, 20px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: clamp(14px, 2.4vh, 26px);
}

/* Header */
.top { display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand img { border-radius: 10px; box-shadow: 0 6px 18px -6px var(--glow-a); }
.brand b { color: var(--brand-hi); font-weight: 800; }
.badge { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; color: var(--mute); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px; font: 800 15px/1 var(--font); text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.btn:focus-visible, .copy:focus-visible, .retry:focus-visible, .foot a:focus-visible, .addr a:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 3px; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-lo)); box-shadow: 0 10px 28px -10px var(--glow-a), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px var(--glow-a), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-ghost { color: var(--text); background: var(--card); border-color: var(--line); }
.btn-ghost:hover { background: var(--card-hi); border-color: color-mix(in srgb, var(--brand-hi) 50%, var(--line)); }

/* Stage: hero and the live numbers */
.stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3.6vw, 56px); align-items: center; }
.eyebrow { margin: 0 0 14px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-hi); }
h1 { margin: 0; font-size: clamp(40px, 6.2vw, 78px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 800; text-wrap: balance; }
h1 em { font-style: normal; background: linear-gradient(100deg, var(--brand-hi), #60a5fa 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { margin: 20px 0 26px; max-width: 46ch; color: var(--mute); font-size: clamp(16px, 1.45vw, 18.5px); line-height: 1.55; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 24px 0 0; padding: 0; color: var(--mute); font-size: 13.5px; font-weight: 700; }
.trust li { display: inline-flex; align-items: center; gap: 7px; }
.trust svg { width: 17px; height: 17px; fill: none; stroke: var(--brand-hi); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 16px); }
.card { position: relative; overflow: hidden; padding: clamp(14px, 1.4vw, 20px); border: 1px solid var(--line); border-radius: 20px; background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); grid-column: span 2; animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--i) * 70ms + 80ms); transition: border-color 0.25s ease, background 0.25s ease; }
.card:hover { border-color: color-mix(in srgb, var(--brand-hi) 45%, var(--line)); background: var(--card-hi); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card h2 { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.num { margin: 6px 0 2px; font-size: clamp(32px, 3.7vw, 48px); line-height: 1.02; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-xl { font-size: clamp(40px, 5vw, 64px); background: linear-gradient(100deg, var(--text), var(--brand-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num small { font-size: 0.42em; font-weight: 800; letter-spacing: 0; color: var(--mute); -webkit-text-fill-color: var(--mute); margin-left: 0.25em; }
.sub { margin: 0; min-height: 1.4em; color: var(--faint); font-size: 13.5px; font-weight: 600; }
.card-gas, .card-txs { grid-column: span 3; }
.card-escrow { grid-column: span 6; }
.drops { position: absolute; right: 14px; top: 14px; width: clamp(56px, 6vw, 84px); fill: var(--brand); opacity: 0.22; animation: bob 5s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(4px) rotate(3deg); } }
.meter { height: 8px; margin: 12px 0 10px; border-radius: 99px; background: color-mix(in srgb, var(--text) 9%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #60a5fa); transition: width 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s; }
.loading .num span { opacity: 0.35; }
.dash { color: var(--faint); -webkit-text-fill-color: var(--faint); }

/* Contracts */
.contracts { padding: clamp(14px, 1.6vw, 20px); border: 1px solid var(--line); border-radius: 22px; background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.contracts-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.contracts-head h2 { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.chips li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--mute); background: color-mix(in srgb, var(--text) 6%, transparent); }
.chips li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.chips li.ok { color: var(--live); }
.chips li.ok::before { background: var(--live); }
.chips li.bad { color: var(--warn); }
.chips li.bad::before { background: var(--warn); }
.addr-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.addr { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--text) 4%, transparent); border: 1px solid transparent; transition: border-color 0.2s ease; }
.addr:hover { border-color: var(--line); }
.addr .label { font-size: 13px; font-weight: 800; }
.addr .note { font-size: 12px; font-weight: 600; color: var(--faint); line-height: 1.3; min-height: 2.6em; }
.addr .row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.addr code { font: 600 12.5px/1 var(--mono); color: var(--brand-hi); letter-spacing: -0.01em; margin-right: auto; }
.copy, .addr a.out { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--mute); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.copy:hover, .addr a.out:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.copy svg, .addr a.out svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Footer */
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; color: var(--faint); font-size: 13px; font-weight: 700; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { text-decoration: none; color: var(--mute); }
.foot a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.live { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pulse.on { background: var(--live); animation: ping 2.2s ease-out infinite; }
.pulse.err { background: var(--warn); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.retry { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 3px 10px; font: 800 12px var(--font); cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); padding: 9px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Medium: stack the stage, keep the numbers in a tidy grid */
@media (max-width: 1020px) {
  .stage { grid-template-columns: 1fr; align-items: start; }
  .lede { max-width: 56ch; }
  .addr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .addr .note { min-height: 0; }
}
@media (max-width: 640px) {
  .page { gap: 18px; }
  .top { flex-wrap: wrap; row-gap: 10px; }
  .badge { margin-left: 0; order: 3; }
  #open-app { margin-left: auto; }
  .actions .btn { flex: 1 1 100%; }
  .trust { margin-top: 18px; }
  /* Three small figures side by side, then the big ones full width */
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .card { grid-column: span 2; border-radius: 18px; padding: 14px 12px; }
  .card h2 { font-size: 11px; letter-spacing: 0.05em; }
  .card:not(.card-gas):not(.card-txs):not(.card-escrow) .sub { display: none; }
  .card-gas, .card-txs, .card-escrow { grid-column: span 6; padding: 16px; }
  .num { font-size: clamp(30px, 9.5vw, 40px); }
  .num-xl { font-size: clamp(42px, 14vw, 60px); }
  /* Contracts as slim rows: name on the left, address and actions on the right */
  .addr-grid { grid-template-columns: 1fr; gap: 6px; }
  .addr { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
  .addr .note { display: none; }
  .addr .row { margin-top: 0; }
  .addr code { margin-right: 6px; }
  .foot { flex-direction: column; align-items: flex-start; }
}

/* Short desktop windows (a 13-inch laptop with browser chrome): trim the vertical rhythm so everything still fits one screen */
@media (min-width: 1021px) and (max-height: 860px) {
  .page { gap: 12px; padding-top: 14px; padding-bottom: 12px; }
  h1 { font-size: clamp(38px, min(5.4vw, 9.5vh), 70px); }
  .lede { margin: 12px 0 16px; font-size: 16px; }
  .trust { margin-top: 14px; }
  .stats { gap: 10px; }
  .card { padding: 12px 16px; border-radius: 16px; }
  .num { font-size: clamp(28px, min(3.4vw, 5.6vh), 42px); margin: 2px 0 0; }
  .num-xl { font-size: clamp(34px, min(4.4vw, 7vh), 56px); }
  .sub { font-size: 12.5px; }
  .card-escrow { display: grid; grid-template-columns: auto 1fr; column-gap: 24px; align-items: center; }
  .card-escrow h2 { grid-column: 1 / -1; }
  .card-escrow .num { grid-row: 2 / span 2; }
  .card-escrow .meter { margin: 0 0 6px; align-self: end; }
  .card-escrow .sub { align-self: start; }
  .contracts { padding: 12px 14px; border-radius: 16px; }
  .contracts-head { margin-bottom: 8px; }
  .addr { padding: 8px 10px; }
  .addr .note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora i, .drops, .pulse.on { animation: none; }
  .card { animation: none; }
  .meter i { transition: none; }
}
