/* X Relay, v1 */

:root {
  --ground: #0a0a0a;
  --panel: #111111;
  --panel-2: #141414;
  --raise: #181818;
  --line: #1f1f1f;
  --line-soft: #191919;
  --ink: #ededed;
  --ink-2: #a8a8a8;
  --ink-3: #6f6f6f;
  --white: #ffffff;
  --live: #4ade80;
  --warn: #fbbf24;
  --down: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 244px;
  --topbar: 56px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--white); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
svg { flex: none; }
.icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--ground);
}

.brand { display: flex; align-items: center; gap: 9px; height: var(--topbar); padding: 0 16px; border-bottom: 1px solid var(--line); }
.brand svg { width: 22px; height: 22px; }
.brand b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 16px 10px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13.5px;
}
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--raise); color: var(--white); font-weight: 500; }

.side-foot { padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ca-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 11.5px; color: var(--ink-3); background: var(--panel);
}
.ca-pill b { color: var(--ink-2); font-weight: 500; letter-spacing: 0.04em; }
.ca-pill span { font-family: var(--mono); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar); padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.86); backdrop-filter: blur(10px);
}

.search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input {
  width: 100%; height: 34px; padding: 0 12px 0 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: #2e2e2e; }
.results {
  position: absolute; top: 40px; left: 0; right: 0; z-index: 40;
  max-height: 340px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}
.results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; text-align: left; }
.results button:hover { background: var(--raise); }
.results .sym { font-weight: 600; min-width: 62px; }
.results .nm { color: var(--ink-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; color: var(--ink-2); white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.status-pill[data-state="live"] .dot { background: var(--live); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14); }
.status-pill[data-state="degraded"] .dot { background: var(--warn); }
.status-pill[data-state="offline"] .dot { background: var(--down); }
.status-pill[data-state="connecting"] .dot { background: var(--ink-3); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}
.btn:hover { background: var(--raise); border-color: #2a2a2a; }
.btn-primary { background: var(--white); color: #0a0a0a; border-color: var(--white); }
.btn-primary:hover { background: #e6e6e6; border-color: #e6e6e6; color: #0a0a0a; }
.btn-lg { height: 42px; padding: 0 18px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel); color: var(--ink); }

/* ---------- layout ---------- */

.main { min-width: 0; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 24px 40px; }
.grid > * { min-width: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; justify-content: space-between; margin-bottom: 20px; }
.eyebrow { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.h1-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lede { color: var(--ink-2); margin: 8px 0 0; max-width: 62ch; }
h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }

.chain-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); font-size: 12px; color: var(--ink-2);
}
.chain-chip i { font-style: normal; color: var(--ink-3); }

.swap-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.card-body { padding: 16px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .more { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.stat .s { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---------- terminal ---------- */

.terminal { display: grid; grid-template-columns: 1fr 1fr; }
.terminal > .side { padding: 18px; }
.terminal > .side + .side { border-left: 1px solid var(--line-soft); }
.side-label { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

.toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.toggle button { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; color: var(--ink-3); }
.toggle button[aria-pressed="true"] { background: var(--raise); color: var(--white); }

.identity { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--raise); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.identity b { display: block; font-weight: 500; }
.identity span { color: var(--ink-3); font-size: 12.5px; }

.amount-row { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 4px; }
.amount-row .cur { font-size: 26px; color: var(--ink-3); }
.amount-input { width: 100%; background: none; border: 0; outline: none; font-size: 34px; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.amount-input::placeholder { color: #333; }
.hr { height: 1px; background: var(--line-soft); margin: 16px 0; }

.field {
  width: 100%; height: 36px; padding: 0 11px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); outline: none;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: #2e2e2e; }
.field:disabled { color: var(--ink-3); cursor: not-allowed; }

.pick {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.pick:hover { border-color: #2a2a2a; }
.pick .sym { font-weight: 600; }
.pick .nm { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .px { margin-left: auto; color: var(--ink-2); font-family: var(--mono); }

.logo-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--raise); display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: var(--ink-2); overflow: hidden; }
.logo-badge img { width: 100%; height: 100%; object-fit: cover; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; }
.kv .k { color: var(--ink-3); }
.kv .v { font-family: var(--mono); text-align: right; }
.kv + .kv { border-top: 1px solid var(--line-soft); }

.terminal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.terminal-foot p { margin: 0; color: var(--ink-3); font-size: 12.5px; max-width: 58ch; }

.swap-arrow {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-2);
}
.terminal-shell { position: relative; }

/* ---------- route strip ---------- */

.route-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: stretch; }
.route-step { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; position: relative; }
.route-step .k { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.route-step .v { font-weight: 600; margin-top: 7px; }
.route-step .s { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---------- tabs, tables, rows ---------- */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { padding: 6px 12px; border-radius: 999px; border: 1px solid transparent; color: var(--ink-3); font-size: 13px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--raise); border-color: var(--line); color: var(--white); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500; font-size: 11.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sym-cell { display: flex; align-items: center; gap: 10px; }
.sym-cell b { font-weight: 600; }
.sym-cell span { color: var(--ink-3); font-size: 12.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 11.5px; color: var(--ink-2); white-space: nowrap;
}
.tag-live { color: var(--live); border-color: rgba(74, 222, 128, 0.28); }
.tag-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.28); }
.tag-down { color: var(--down); border-color: rgba(248, 113, 113, 0.28); }

.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.empty p { margin: 0 auto; max-width: 46ch; font-size: 13px; }

.rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.asset-card { display: flex; align-items: center; gap: 11px; padding: 13px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.asset-card:hover { border-color: #2a2a2a; }
.asset-card .col { min-width: 0; }
.asset-card b { display: block; font-weight: 600; }
.asset-card span { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .px { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 13px; }
.asset-card .px small { display: block; color: var(--ink-3); font-size: 11px; font-family: var(--sans); }

.cover { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cover .card { padding: 15px 16px; }
.cover b { display: block; margin-bottom: 5px; }
.cover p { margin: 0; color: var(--ink-3); font-size: 13px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; counter-reset: s; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.step i { font-style: normal; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--raise); color: var(--ink-2); font-size: 12px; margin-bottom: 9px; }

/* ---------- sheet ---------- */

.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; padding: 18px; }
.sheet { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.sheet-body { padding: 16px; }
.sheet-body p { margin: 0 0 14px; color: var(--ink-2); }
.sheet-list { max-height: 60vh; overflow-y: auto; }
.sheet-list button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 16px; text-align: left; }
.sheet-list button:hover { background: var(--panel-2); }

.note { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink-2); font-size: 13px; }
.note .icon { color: var(--ink-3); margin-top: 2px; }

/* ---------- docs prose ---------- */

.prose { max-width: 74ch; }
.prose h2 { margin: 30px 0 10px; font-size: 17px; }
.prose h3 { margin: 22px 0 8px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 18px; }
.prose li { margin: 6px 0; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
pre b { color: var(--ink); font-weight: 500; }
.method { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel-2); }

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

.foot { border-top: 1px solid var(--line); padding: 20px 24px 34px; color: var(--ink-3); font-size: 12.5px; }
.foot-in { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: space-between; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot p { margin: 0; max-width: 78ch; }

/* ---------- mobile ---------- */

.mobile-bar { display: none; }
.drawer-btn { display: none; }

@media (max-width: 1040px) {
  .swap-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .terminal { grid-template-columns: 1fr; }
  .terminal > .side + .side { border-left: 0; border-top: 1px solid var(--line-soft); }
  .route-strip { grid-template-columns: repeat(2, 1fr); }
  .swap-arrow { top: 50%; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 70; left: 0; top: 0; bottom: 0; width: 264px;
    transform: translateX(-100%); transition: transform 0.2s ease; border-right: 1px solid var(--line);
  }
  body[data-drawer="open"] .sidebar { transform: none; }
  body[data-drawer="open"]::after { content: ""; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.6); }
  .drawer-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink-2); }
  .wrap { padding: 18px 16px 96px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .search { max-width: none; margin: 0; }
  .topbar .status-pill { display: none; }
  h1 { font-size: 22px; }
  .mobile-bar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-bar a { display: grid; justify-items: center; gap: 4px; padding: 9px 2px 10px; font-size: 10.5px; color: var(--ink-3); }
  .mobile-bar a[aria-current="page"] { color: var(--white); }
  .foot { padding: 20px 16px 100px; }
  .route-strip { grid-template-columns: 1fr; }
  .swap-arrow { position: static; transform: none; margin: 2px auto; }
}

/* Hero emblem. The flat mark draws in, then resolves into the coin, then the relay rings close
   around it. One run on load, then a quiet idle. Transform and opacity only. */
.hero-id { display: flex; align-items: center; gap: 22px; min-width: 0; }
.hero-id > div:last-child { min-width: 0; }
.emblem { position: relative; flex: 0 0 auto; width: 152px; aspect-ratio: 1; }
.emblem > * { position: absolute; }
.em-rings { inset: 0; width: 100%; height: 100%; overflow: visible; }
.em-ring, .em-runner { fill: none; stroke: #e9ffd6; stroke-width: 1.4; stroke-linecap: round; filter: drop-shadow(0 0 3px #7cff4f) drop-shadow(0 0 8px rgba(124,255,79,.55)); stroke-dasharray: 1; stroke-dashoffset: 1; animation: em-draw 1.1s cubic-bezier(.22,.8,.2,1) 1.35s forwards; }
.em-ring2 { stroke-width: 1; opacity: .7; animation-delay: 1.5s; }
.em-runner { stroke: #fff; stroke-width: 2.2; stroke-dasharray: .07 .93; stroke-dashoffset: 0; opacity: 0; animation: em-run 3.6s linear 2.5s infinite, em-show .4s ease 2.5s forwards; }
.em-coin { left: 15%; top: 15%; width: 70%; height: 70%; opacity: 0; transform: scale(.84); animation: em-coin .9s cubic-bezier(.2,.8,.2,1) .75s forwards, em-float 6s ease-in-out 2.6s infinite; }
.em-flat { left: 18.8%; top: 23.5%; width: 60.5%; height: 60.5%; color: #fff; --accent: #f5b324; opacity: 0; transform: scale(.82); animation: em-flat-in .55s cubic-bezier(.2,.8,.2,1) .05s forwards, em-flat-out .7s ease .85s forwards; }
@keyframes em-flat-in { to { opacity: 1; transform: scale(1); } }
@keyframes em-flat-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes em-coin { to { opacity: 1; transform: scale(1); } }
@keyframes em-float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-3px) scale(1); } }
@keyframes em-draw { to { stroke-dashoffset: 0; } }
@keyframes em-run { to { stroke-dashoffset: -1; } }
@keyframes em-show { to { opacity: .95; } }
@media (max-width: 720px) { .hero-id { gap: 14px; align-items: flex-start; } .emblem { width: 76px; margin-top: 2px; } }
@media (prefers-reduced-motion: reduce) {
  .em-coin { animation: none; opacity: 1; transform: none; }
  .em-flat { animation: none; opacity: 0; }
  .em-ring { animation: none; stroke-dashoffset: 0; }
  .em-runner { animation: none; opacity: 0; }
}
