/* Zylaunch — one stylesheet, CSS variables for both themes, mobile first. */

:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7dc;
  --ink: #1b1d22;
  --ink-2: #4a4d55;
  --ink-3: #6f727a;
  --line: #d9d3c6;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3d4;
  --teal: #0f766e;
  --teal-soft: #d5ede9;
  --warn: #9a5b00;
  --warn-soft: #fbefd2;
  --bad: #b42318;
  --bad-soft: #fde4e1;
  --ok: #15803d;
  --ok-soft: #dcf2e2;
  --level-empty: #e3ddd0;
  --level-fill: #c2410c;
  --level-current: #0f766e;
  --shadow: 0 1px 2px rgb(27 29 34 / 6%), 0 4px 16px rgb(27 29 34 / 5%);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #161a1f;
    --surface-2: #1e232a;
    --ink: #ece8e0;
    --ink-2: #b9b5ad;
    --ink-3: #8d8a84;
    --line: #2b3139;
    --accent: #ff7a3d;
    --accent-ink: #1b0d05;
    --accent-soft: #3a2116;
    --teal: #3cc6b8;
    --teal-soft: #12302d;
    --warn: #f1b54a;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1a18;
    --ok: #5fd38a;
    --ok-soft: #13301f;
    --level-empty: #252b33;
    --level-fill: #ff7a3d;
    --level-current: #3cc6b8;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #161a1f;
  --surface-2: #1e232a;
  --ink: #ece8e0;
  --ink-2: #b9b5ad;
  --ink-3: #8d8a84;
  --line: #2b3139;
  --accent: #ff7a3d;
  --accent-ink: #1b0d05;
  --accent-soft: #3a2116;
  --teal: #3cc6b8;
  --teal-soft: #12302d;
  --warn: #f1b54a;
  --warn-soft: #33270f;
  --bad: #ff8a80;
  --bad-soft: #3a1a18;
  --ok: #5fd38a;
  --ok-soft: #13301f;
  --level-empty: #252b33;
  --level-fill: #ff7a3d;
  --level-current: #3cc6b8;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  overflow-x: hidden;
}
a { color: var(--accent); text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.mono { overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font: 600 clamp(1.7rem, 5vw, 2.6rem)/1.1 var(--font-display); letter-spacing: -0.01em; }
h2 { font: 600 1.35rem/1.2 var(--font-display); }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--ink-3); }
.small { font-size: 0.875rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions" "nav nav"; gap: 8px 12px; align-items: center; }
.brand { grid-area: brand; min-width: 0; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 700 1.15rem var(--font-display); }
.brand-mark { width: 28px; height: 28px; }
.brand-mark rect { fill: var(--ink); }
.brand-mark path { stroke: var(--accent); stroke-width: 3; fill: none; stroke-linejoin: round; }
.net-tag { font: 600 0.7rem var(--font); text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal); background: var(--teal-soft); padding: 2px 7px; border-radius: 99px; }
.nav { grid-area: nav; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.top-actions { grid-area: actions; display: flex; gap: 6px; align-items: center; }
.wallet-pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: 600 0.875rem var(--font); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.wallet-pill[data-state="on"] .dot { background: var(--ok); }
.wallet-pill[data-state="bad"] .dot { background: var(--bad); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 420px) { .net-tag { display: none; } }
@media (min-width: 760px) {
  .top-inner { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand nav actions"; }
  .nav { justify-content: center; }
}

/* ---------------------------------------------------------------- testnet notice (always visible, static HTML) */
.testnet-bar { background: var(--warn-soft); color: var(--warn); border-bottom: 2px solid var(--warn);
  text-align: center; font: 600 0.95rem/1.4 var(--font); padding: 8px 16px; letter-spacing: 0.01em; }
.testnet-bar strong { text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------------------------------------------------------------- layout */
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
main:focus { outline: none; }
#banners { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 16px 16px 40px; color: var(--ink-3); font-size: 0.85rem; border-top: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
@media (min-width: 860px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.main-side { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.hero { padding: 8px 0 20px; }
.hero p { max-width: 62ch; color: var(--ink-2); font-size: 1.05rem; }
.eyebrow { font: 600 0.75rem var(--font); text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal); margin-bottom: 6px; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.hint { font-size: 0.82rem; color: var(--ink-3); margin-top: 4px; }
input[type="text"], input[type="search"], select, textarea {
  width: 100%; font: 16px var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0;
}
input.mono { font-family: var(--mono); font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 70px; }
.input-suffix .suffix { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px; font: 600 0.95rem var(--font); cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.small { padding: 4px 10px; font-size: 0.82rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 8px 14px; font: 600 0.9rem var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------------------------------------------------------------- notes */
.note { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; border: 1px solid transparent; margin: 10px 0; }
.note > :last-child { margin-bottom: 0; }
.note.info { background: var(--teal-soft); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.note.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.note.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.note strong { display: block; margin-bottom: 2px; }
.note ol, .note ul { margin: 6px 0 0; padding-left: 20px; }
.banner { margin-top: 12px; }
.badge { display: inline-block; font: 600 0.72rem var(--font); padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.hot { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------------------------- the ladder (40 levels) */
.ladder { display: grid; grid-template-columns: repeat(var(--levels, 40), minmax(0, 1fr)); gap: 2px; align-items: end; height: 150px; padding: 8px 0 0; }
.rung { position: relative; height: calc(18% + var(--step, 0) * 82%); background: var(--level-empty); border-radius: 3px 3px 0 0; overflow: hidden; }
.rung .fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--fill, 0) * 100%); background: var(--level-fill); }
.rung.current { outline: 2px solid var(--level-current); outline-offset: 1px; }
.rung.current .fill { background: var(--level-current); }
.ladder-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-3); margin-top: 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-3); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- stats + tables */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.stat .k { font-size: 0.75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .v { font: 600 1.05rem var(--mono); overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { text-align: right; padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink-3); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); }
tfoot td { font-weight: 700; background: var(--surface-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- token list */
.token-list { display: grid; gap: 10px; }
@media (min-width: 640px) { .token-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .token-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.token-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.token-card:hover { border-color: var(--accent); }
.token-card .sym { font: 700 1.05rem var(--font-display); }
.token-card .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-glyph { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 700 0.95rem var(--font-display); color: #fff; flex: none; }

/* ---------------------------------------------------------------- the run (sequential certificates) */
.steps { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.step { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--bg); }
.step .spread { align-items: center; }
.step[data-state="waiting"] { border-color: var(--teal); }
.step[data-state="done"] { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.step[data-state="failed"] { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.step .detail { font-size: 0.85rem; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); }
details > summary { cursor: pointer; font-weight: 600; }
.addr-box { display: flex; gap: 8px; flex-wrap: wrap; }
.addr-box input { flex: 1 1 260px; }
.price-table td:first-child { font-family: var(--mono); }
