:root {
  --bg: #07090f;
  --bg-soft: #0d111b;
  --panel: #111726;
  --panel-2: #161d2f;
  --line: #212a40;
  --line-soft: #1a2133;
  --ink: #e8ecf5;
  --ink-dim: #97a3bd;
  --ink-faint: #63708c;
  --brand: #f0c14b;
  --brand-dim: #c9971f;
  --brand-glow: rgba(240, 193, 75, 0.16);
  /* A cool blue keeps secondary information from competing with the gold. */
  --accent: #6ba3ff;
  --warn: #ffb020;
  --danger: #ff5d5d;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(240, 193, 75, 0.10), transparent 60%),
    radial-gradient(700px 400px at 88% 0%, rgba(107, 163, 255, 0.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; color: var(--ink-dim); }
code, .mono { font-family: var(--mono); }

.wrap { width: min(1180px, 92vw); margin: 0 auto; position: relative; z-index: 1; }

/* ---------------- header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 15, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav { display: flex; align-items: center; gap: 1.6rem; height: 62px; }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(140deg, #ffd772, #c9971f);
  display: grid; place-items: center; font-size: 15px;
}
.nav-links { display: flex; gap: .3rem; margin-left: .8rem; flex: 1; flex-wrap: wrap; }
.nav-links a {
  padding: .45rem .8rem; border-radius: 8px; color: var(--ink-dim);
  font-size: .92rem; font-weight: 500; transition: .15s;
}
.nav-links a:hover { color: var(--ink); background: var(--panel); }
.nav-links a.active { color: var(--brand); background: var(--brand-glow); }
.nav-right { display: flex; align-items: center; gap: .6rem; }

.chain-pill {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  padding: .28rem .55rem; border-radius: 6px;
  background: rgba(255, 176, 32, .13); color: var(--warn); border: 1px solid rgba(255, 176, 32, .28);
}
.chain-pill.live { background: rgba(240, 193, 75, .13); color: var(--brand); border-color: rgba(240, 193, 75, .32); }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.15rem; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #1c1403; }
.btn-primary:hover { background: #ffd469; transform: translateY(-1px); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel-2); border-color: #2d3853; }
.btn-danger { background: rgba(255, 93, 93, .12); color: var(--danger); border-color: rgba(255, 93, 93, .3); }
.btn-sm { padding: .38rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------- panels ---------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.card-tight { padding: 1rem 1.1rem; }
.card h3 { margin-bottom: .9rem; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-buy { grid-template-columns: 1.15fr .85fr; align-items: start; }

.eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brand); margin-bottom: .7rem;
}

.stat-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.03em; font-family: var(--mono); }
.stat-label { font-size: .78rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.stat-sub { font-size: .82rem; color: var(--ink-dim); margin-top: .2rem; }

.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.up { color: var(--brand); }
.down { color: var(--danger); }
.small { font-size: .84rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mt-2 { margin-top: 1.8rem; }
.mb { margin-bottom: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------------- forms ---------------- */

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-dim); margin-bottom: .35rem; }
input, select, textarea {
  width: 100%; padding: .68rem .8rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink);
  font-family: inherit; font-size: .94rem; transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
input.mono, textarea.mono { font-family: var(--mono); font-size: .86rem; }
.field { margin-bottom: 1rem; }
.field-hint { font-size: .78rem; color: var(--ink-faint); margin-top: .3rem; }

.seg { display: flex; gap: .3rem; background: var(--bg-soft); padding: .28rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: .42rem .5rem; border: none; background: transparent;
  color: var(--ink-dim); border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: .85rem; font-weight: 600; transition: .12s;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--brand); color: #1c1403; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  padding: .32rem .6rem; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--ink-dim); cursor: pointer;
  font-size: .8rem; font-weight: 600; font-family: inherit; transition: .12s;
}
.chip:hover { color: var(--ink); border-color: #2d3853; }
.chip.on { background: var(--brand-glow); color: var(--brand); border-color: rgba(240, 193, 75, .38); }

/* ---------------- tables ---------------- */

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; padding: .5rem .6rem; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint);
  border-bottom: 1px solid var(--line-soft);
}
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* depth bar behind order-book rows */
.depth-row { position: relative; }
.depth-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(240, 193, 75, .09); border-left: 2px solid rgba(240, 193, 75, .4);
  pointer-events: none;
}
.depth-row > * { position: relative; }

/* ---------------- badges ---------------- */

.badge {
  display: inline-block; padding: .18rem .5rem; border-radius: 5px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
}
.badge-filled { background: rgba(240, 193, 75, .14); color: var(--brand); }
.badge-pending { background: rgba(255, 176, 32, .14); color: var(--warn); }
.badge-partial { background: rgba(77, 141, 255, .14); color: var(--accent); }
.badge-expired, .badge-cancelled { background: rgba(150, 163, 189, .12); color: var(--ink-faint); }

/* ---------------- hero ---------------- */

.hero { padding: 4rem 0 2.5rem; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2.5rem; align-items: start; }
.hero h1 { margin-bottom: 1rem; }
.hero h1 .grad {
  background: linear-gradient(100deg, #c9971f, var(--brand) 45%, #fff0c2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: 1.05rem; max-width: 46ch; }
.trust { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1.4rem; }
.trust span { font-size: .85rem; color: var(--ink-dim); display: flex; align-items: center; gap: .35rem; }

.savings {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: .8rem; align-items: center;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 1rem; margin-top: 1.4rem;
}
.savings .old { text-decoration: line-through; color: var(--ink-faint); font-family: var(--mono); font-size: 1.25rem; }
.savings .new { color: var(--brand); font-family: var(--mono); font-size: 1.45rem; font-weight: 700; }

/* ---------------- modal ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 5, 10, .8);
  backdrop-filter: blur(6px); display: none; place-items: center; z-index: 100; padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem; width: min(430px, 100%);
}
/* The list can run to a dozen wallets, so it scrolls inside the modal rather
   than pushing the notice below the fold. */
.wallet-list {
  max-height: min(46vh, 380px); overflow-y: auto;
  margin: 0 -.35rem .2rem; padding: 0 .35rem;
  scrollbar-width: thin;
}
.wallet-option {
  display: flex; align-items: center; gap: .85rem; width: 100%;
  padding: .7rem .9rem; margin-bottom: .45rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink);
  cursor: pointer; font-family: inherit; font-size: .95rem; font-weight: 600;
  text-align: left; transition: .15s;
}
.wallet-option:hover:not(:disabled) { border-color: var(--brand); background: var(--panel-2); }
.wallet-option:disabled { opacity: .4; cursor: not-allowed; }
.wallet-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.wallet-icon svg, .wallet-icon img { display: block; width: 30px; height: 30px; border-radius: 8px; }
.wallet-option:disabled .wallet-icon { filter: grayscale(1); }
.wallet-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.wallet-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-meta { font-size: .76rem; font-weight: 500; color: var(--ink-faint); }
.wallet-badge {
  flex-shrink: 0; font-size: .62rem; font-weight: 700; letter-spacing: .06em;
  padding: .2rem .4rem; border-radius: 5px;
  background: rgba(212, 175, 55, .12); color: var(--brand);
  border: 1px solid rgba(212, 175, 55, .25);
}
.wallet-badge.inline { display: inline-block; vertical-align: baseline; }
/* The deep links are anchors, not buttons, so they need the underline off and
   the notice's own text colour overridden. */
a.wallet-option { text-decoration: none; color: var(--ink); margin-top: .5rem; }
a.wallet-option:hover { border-color: var(--brand); background: var(--panel-2); }
.wallet-divider {
  margin: .8rem 0 .5rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}

/* ---------------- notices ---------------- */

.notice {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft);
  font-size: .87rem; color: var(--ink-dim); margin-bottom: 1rem;
}
.notice-warn { border-color: rgba(255, 176, 32, .3); background: rgba(255, 176, 32, .07); color: #f0d097; }
.notice-info { border-color: rgba(77, 141, 255, .3); background: rgba(77, 141, 255, .07); color: #b9d0ff; }
.notice-ok { border-color: rgba(240, 193, 75, .32); background: rgba(240, 193, 75, .07); color: #f4dda0; }
.notice-error { border-color: rgba(255, 93, 93, .32); background: rgba(255, 93, 93, .08); color: #ffb3b3; }
.notice b { color: inherit; }

.copy-box {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .75rem;
  font-family: var(--mono); font-size: .84rem; word-break: break-all;
}
.copy-box span { flex: 1; }

/* ---------------- toast ---------------- */

#toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  font-size: .87rem; max-width: 340px; animation: slide-in .22s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.toast.ok { border-color: rgba(240, 193, 75, .4); }
.toast.err { border-color: rgba(255, 93, 93, .4); }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------------- code ---------------- */

pre {
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 1rem;
  overflow-x: auto; font-family: var(--mono); font-size: .82rem;
  line-height: 1.6; color: #cfd8ea; margin: 0 0 1rem;
}
pre .k { color: #ff9db8; }
pre .s { color: #9be9c6; }
pre .c { color: var(--ink-faint); }

.method {
  display: inline-block; padding: .12rem .45rem; border-radius: 5px;
  font-family: var(--mono); font-size: .72rem; font-weight: 700; margin-right: .5rem;
}
.method.get { background: rgba(77, 141, 255, .16); color: var(--accent); }
.method.post { background: rgba(240, 193, 75, .16); color: var(--brand); }
.method.delete { background: rgba(255, 93, 93, .16); color: var(--danger); }

/* ---------------- footer ---------------- */

.site-footer {
  margin-top: 4rem; padding: 2rem 0; border-top: 1px solid var(--line-soft);
  color: var(--ink-faint); font-size: .85rem;
}

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .hero-grid, .grid-buy { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nav { height: auto; padding: .7rem 0; flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; margin-left: 0; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .savings { grid-template-columns: 1fr; text-align: center; }
}
