:root {
  --bg: #141414;
  --card: #1a1a1a;
  --card-2: #212121;
  --line: #252525;
  --line-soft: #212121;
  --text: #fafafa;
  --muted: #9a9a9a;
  --dim: #636363;
  --green: #0fb983;
  --green-line: #10a073;
  --green-bg: rgba(15, 185, 131, 0.12);
  --amber: #f5b54a;
  --amber-bg: rgba(245, 181, 74, 0.12);
  --chip: rgba(250, 250, 250, 0.08);
  --radius: 20px;
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Moving sky ---------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky .st { position: absolute; inset: 0; background-repeat: repeat; background-size: 1440px 800px; }
.sky .far { background-image: url(/img/stars-far.png); animation: drift 420s linear infinite; }
.sky .mid { background-image: url(/img/stars-mid.png); animation: drift 200s linear infinite; }
.sky .near { background-image: url(/img/stars-near.png); animation: drift 110s linear infinite, twinkle 5s ease-in-out infinite alternate; }
@keyframes drift { from { background-position: 0 0; } to { background-position: -1440px -800px; } }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sky .st { animation: none; } }

.page { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.top { padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.top-left { display: flex; align-items: center; gap: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Montserrat', var(--font); font-weight: 500; font-size: 21px; letter-spacing: 0.01em; }
.brand img { border-radius: 50%; display: block; }
.nav { display: flex; gap: 28px; font-size: 14px; font-weight: 500; line-height: 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); }
.nav a[aria-current='page'] { color: var(--text); text-decoration: underline; text-underline-offset: 6px; }
.btn-white { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; border-radius: 1000px; padding: 11px 16px; border: 0; cursor: pointer; }
.btn-white:hover { background: #fff; }
.btn-ghost { display: flex; align-items: center; justify-content: center; color: var(--muted); border: 1px solid var(--line); border-radius: 1000px; font-size: 14px; font-weight: 500; padding: 13px 24px; }
.btn-ghost:hover { color: var(--text); }
.btn-big { width: 100%; font-size: 16px; line-height: 24px; padding: 14px 24px; }

/* ---------- Layout ---------- */
main { flex: 1; }
.wrap { max-width: 1104px; margin: 0 auto; padding: 56px 24px 120px; }
.wrap-narrow { max-width: 760px; }
.title { text-align: center; font-size: 60px; font-weight: 500; letter-spacing: -3px; line-height: 56px; margin: 0; }
.title .soft { color: var(--muted); }
.lead { text-align: center; font-size: 14px; line-height: 18px; color: var(--muted); margin: 20px auto 0; max-width: 360px; }
.label { font-size: 12px; line-height: 16px; color: var(--muted); }
.value { font-size: 16px; font-weight: 500; line-height: 24px; }
.green { color: var(--green); }
.amber { color: var(--amber); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-2 { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.stats { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat-head { display: flex; justify-content: space-between; align-items: center; }
.ico { width: 25px; height: 25px; border-radius: 50%; background: var(--chip); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.stat .value { margin-top: 14px; }

/* ---------- Pills / tabs ---------- */
.tabs { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 71px; padding: 6px; box-shadow: rgba(20, 20, 20, 0.43) 0 4px 12px 0; }
.tab { flex: 1; border: 0; border-radius: 48px; font-size: 14px; font-weight: 500; min-height: 38px; cursor: pointer; background: transparent; color: var(--muted); }
.tab[aria-pressed='true'] { background: var(--green-bg); color: var(--green); }
.pill { border-radius: 1000px; font-size: 12px; font-weight: 500; padding: 0 14px; min-height: 32px; cursor: pointer; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.pill[aria-pressed='true'] { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip { font-size: 12px; border-radius: 48px; padding: 5px 10px; background: var(--chip); color: var(--muted); }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }

/* ---------- Home widget ---------- */
.widget-zone { display: flex; flex-direction: column; align-items: center; padding: 64px 16px 0; }
.widget { width: 100%; max-width: 420px; }
.widget-meta { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.token { width: 40px; height: 40px; border-radius: 50%; background: #2c2c2c; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.token.ok { background: var(--green-bg); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.amount { margin-top: 18px; width: 100%; background: transparent; border: 0; outline: none; font-size: 32px; font-weight: 500; letter-spacing: -1px; padding: 0; }
.big { font-size: 32px; font-weight: 500; letter-spacing: -1px; }
.joiner { display: flex; justify-content: center; margin: -4px 0; position: relative; z-index: 1; }
.joiner span { width: 30px; height: 30px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.facts { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; line-height: 16px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }

/* ---------- Table ---------- */
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; gap: 12px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.grid-row { display: grid; grid-template-columns: 2.4fr 1fr 1fr 1fr 0.9fr 1.3fr 24px; gap: 12px; padding: 14px 16px; font-size: 14px; line-height: 20px; border-top: 1px solid var(--line-soft); align-items: center; min-width: 920px; }
.grid-row.head { font-size: 12px; line-height: 16px; color: var(--muted); border-top: 1px solid var(--line); padding: 10px 16px; }
a.grid-row:hover { background: rgba(250, 250, 250, 0.02); }
.footnote { font-size: 12px; line-height: 16px; color: var(--dim); margin-top: 14px; text-align: center; }

/* ---------- Vault page ---------- */
.chart { width: 100%; height: auto; display: block; margin-top: 12px; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 20px; align-items: center; }
.code { font-family: var(--mono); font-size: 13px; line-height: 22px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: #e6e6e6; overflow-x: auto; white-space: pre; margin: 12px 0 0; }
ul.plain { margin: 10px 0 0; padding-left: 18px; color: #c8c8c8; font-size: 14px; line-height: 24px; }
.check { display: grid; grid-template-columns: 25px 1fr auto; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.check .ico { background: var(--green-bg); color: var(--green); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
.foot { text-align: center; font-size: 13px; line-height: 26px; color: var(--dim); padding: 40px 16px 48px; }
.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 640px) {
  .top { padding: 16px; }
  .top-left { gap: 20px; }
  .title { font-size: 44px; line-height: 44px; letter-spacing: -2px; }
  .wrap { padding: 36px 16px 96px; }
}

/* ---------- Swap ---------- */
.select { appearance: none; background: #2a2a2a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239a9a9a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line); border-radius: 1000px; color: var(--text); font-size: 13px; font-weight: 500; padding: 8px 30px 8px 12px; min-height: 36px; max-width: 170px; cursor: pointer; }
.select:focus-visible, .amount:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
#to-amount { color: var(--text); }
.btn-white:disabled { background: #7c7c7c; color: #3f3f3f; cursor: not-allowed; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; font-size: 14px; line-height: 20px; color: var(--muted); }
.step.active, .step.done { color: var(--text); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--chip); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.step.active .step-dot { background: var(--green-bg); color: var(--green); box-shadow: 0 0 0 1px var(--green-line); }
.step.done .step-dot { background: var(--green-bg); color: var(--green); }
.step.error .step-dot { background: var(--amber-bg); color: var(--amber); }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 20; }
.wallet-menu { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, calc(100vw - 32px)); }
.wallet-option { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; cursor: pointer; text-align: left; }
.wallet-option:hover { border-color: var(--green-line); }
.wallet-option img { border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Logos ---------- */
.logo { border-radius: 50%; object-fit: cover; flex: none; background: #2a2a2a; display: inline-block; }
.logo-letter { display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-weight: 600; }
.logo-pair { position: relative; display: inline-block; flex: none; }
.logo-pair > .logo { position: absolute; left: 0; top: 0; }
.logo-sub { position: absolute; right: 0; bottom: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); line-height: 0; }

/* ---------- Pickers and dialogs ---------- */
.select-btn { display: inline-flex; align-items: center; gap: 8px; background: #2a2a2a; border: 1px solid var(--line); border-radius: 1000px; font-size: 13px; font-weight: 500; padding: 5px 12px 5px 6px; min-height: 36px; cursor: pointer; max-width: 180px; }
.select-btn span:not(.chev) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn:hover { border-color: #3a3a3a; }
.chev { color: var(--muted); font-size: 11px; }
.max-btn { background: var(--green-bg); color: var(--green); border: 0; border-radius: 1000px; font-size: 11px; font-weight: 600; padding: 3px 9px; cursor: pointer; }
.pill-link { display: inline-flex; align-items: center; }
.dialog-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog-wrap .backdrop { position: absolute; inset: 0; z-index: 0; }
.dialog { position: relative; z-index: 1; width: min(420px, 100%); max-height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; padding: 16px; }
.picker-search { width: 100%; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; color: var(--text); font-size: 15px; padding: 12px 14px; outline: none; }
.picker-search:focus { border-color: var(--green-line); }
.picker-list { margin-top: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.picker-item { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 14px; padding: 10px; text-align: left; cursor: pointer; font-size: 15px; }
.picker-item:hover, .picker-item:focus-visible { background: var(--card-2); border-color: var(--line); }
.picker-text { display: flex; flex-direction: column; min-width: 0; }
.picker-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: transparent; border: 0; color: var(--muted); font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: var(--chip); color: var(--text); }

/* ---------- Tables ---------- */
.v-row { grid-template-columns: 2.6fr 1.1fr 0.9fr 0.8fr 1.3fr 1fr 1fr; min-width: 980px; }
.p-row { grid-template-columns: 2.6fr 0.8fr 0.9fr 0.8fr 0.9fr 0.9fr 1.4fr; min-width: 980px; }
.v-split { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 10px; align-items: start; }
@media (max-width: 860px) { .v-split { grid-template-columns: 1fr; } }

/* Phones: rows become cards with labelled values. */
@media (max-width: 720px) {
  .table-scroll .grid-row { min-width: 0; grid-template-columns: 1fr 1fr; row-gap: 10px; padding: 14px 16px; }
  .table-scroll .grid-row.head { display: none; }
  .table-scroll .grid-row > .cell-main { grid-column: 1 / -1; }
  .table-scroll .grid-row > div[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-bottom: 2px; }
  .table-scroll .grid-row > div:last-child:not([data-label]) { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
}
