:root {
  color-scheme: dark;
  --bg: #07090c;
  --panel: #0d1117;
  --panel-2: #111720;
  --line: #202936;
  --line-hot: #344454;
  --text: #edf3f8;
  --muted: #7e8b99;
  --cyan: #85f4e4;
  --cyan-dim: #153e3c;
  --orange: #ff814a;
  --red: #ff6b6b;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 72% 4%, rgba(63, 120, 115, 0.12), transparent 30rem),
    linear-gradient(180deg, #080b0f, var(--bg));
  font-family: var(--sans);
}

.grid-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .18;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .16em;
}

.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); gap: 3px; transform: skew(-12deg); }
.brand-mark i { display: block; width: 8px; height: 20px; background: var(--cyan); }
.brand-mark i:last-child { height: 13px; margin-top: 7px; background: var(--orange); }

.network-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a8b3bd;
  font: 600 .72rem/1 var(--mono);
  letter-spacing: .08em;
}

.network-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }

main { width: min(1020px, calc(100% - 40px)); margin: 0 auto; }

.intro { padding: 112px 0 54px; }

.eyebrow {
  margin: 0 0 22px;
  color: var(--cyan);
  font: 700 .76rem/1 var(--mono);
  letter-spacing: .16em;
}

h1 {
  margin: 0;
  max-width: 850px;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: .91;
  letter-spacing: -.065em;
  font-weight: 760;
}

h1 span { color: #64707b; }

.lede {
  max-width: 610px;
  margin: 30px 0 42px;
  color: #9da8b3;
  font-size: 1.05rem;
  line-height: 1.7;
}

.search-panel {
  padding: 17px;
  border: 1px solid var(--line-hot);
  background: rgba(13, 17, 23, .84);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.search-panel > label {
  display: block;
  margin: 0 0 12px;
  color: var(--muted);
  font: 650 .7rem/1 var(--mono);
  letter-spacing: .11em;
}

.search-row { display: grid; grid-template-columns: auto 1fr auto; align-items: stretch; min-height: 58px; }

.prompt {
  display: grid;
  place-items: center;
  width: 62px;
  border: 1px solid var(--line);
  border-right: 0;
  color: var(--cyan);
  background: #0a0e13;
  font: 700 .8rem var(--mono);
}

#contract-address {
  min-width: 0;
  border: 1px solid var(--line);
  border-right: 0;
  outline: none;
  padding: 0 18px;
  color: var(--text);
  background: #0a0e13;
  font: .9rem var(--mono);
  transition: border-color .2s, box-shadow .2s;
}

#contract-address::placeholder { color: #4f5b66; }
#contract-address:focus { border-color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(133,244,228,.12); }

button {
  min-width: 176px;
  border: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #05110f;
  background: var(--cyan);
  font: 800 .78rem var(--mono);
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .2s, transform .2s;
}

button:hover { background: #a6fff2; }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; color: #74918e; background: #17302f; }

.form-message { min-height: 0; margin: 0; color: var(--red); font: .78rem var(--mono); }
.form-message:not(:empty) { margin-top: 12px; }

.form-options { display: flex; justify-content: flex-end; margin-top: 13px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; color: #87939f; font: .72rem var(--mono); cursor: pointer; user-select: none; }
.toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.toggle-track { width: 34px; height: 18px; padding: 2px; display: inline-flex; align-items: center; border: 1px solid #36414d; border-radius: 999px; background: #141a21; transition: border-color .2s, background .2s; }
.toggle-track i { width: 12px; height: 12px; border-radius: 50%; background: #697581; transition: transform .2s, background .2s; }
.toggle input:checked + .toggle-track { border-color: rgba(133,244,228,.5); background: var(--cyan-dim); }
.toggle input:checked + .toggle-track i { background: var(--cyan); transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--cyan); outline-offset: 3px; }

.process { margin: 23px 3px 0; display: flex; align-items: center; gap: 14px; }
.process div { display: flex; align-items: center; gap: 9px; white-space: nowrap; color: #697581; font: .72rem var(--mono); }
.process b { color: #b5c0ca; font-weight: 500; }
.process i { flex: 1; height: 1px; background: var(--line); }

.results { padding: 14px 0 90px; }
.results[hidden] { display: none; }

.result-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.result-heading h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.03em; }
.trace-status { display: flex; align-items: center; gap: 8px; color: var(--cyan); font: .72rem var(--mono); letter-spacing: .08em; }
.trace-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.token-card, .detail-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(17,23,32,.98), rgba(10,14,19,.98));
}

.token-card { display: block; }
.token-main { min-width: 0; padding: 28px; }
.token-title { display: flex; align-items: center; gap: 16px; }
.token-title .image-stack { width: 56px; height: 56px; }
.token-logo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #171d24; }
.token-logo-fallback { display: grid; place-items: center; width: 100%; height: 100%; border: 1px solid #34404c; border-radius: 50%; color: var(--cyan); background: #171d24; font: 700 1.1rem var(--mono); }
.token-title h3 { margin: 0 0 4px; font-size: 1.4rem; }
.token-title p { margin: 0; color: var(--muted); font: .76rem var(--mono); }
.address-line { margin: 26px 0 0; }
.field-label { display: block; margin-bottom: 8px; color: #687581; font: .66rem var(--mono); letter-spacing: .1em; }
.copy-value { display: flex; align-items: center; gap: 10px; min-width: 0; }
.copy-value code { overflow: hidden; color: #b9c4ce; font: .78rem var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.copy-button { min-width: auto; padding: 3px 5px; color: var(--muted); background: transparent; font-size: .72rem; }
.copy-button:hover { color: var(--cyan); background: transparent; }

.section-label { margin: 36px 0 12px; color: #788692; font: 700 .7rem var(--mono); letter-spacing: .12em; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.detail-card { min-width: 0; padding: 24px; }
.detail-card.full { width: 100%; }
.detail-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.detail-topline h3 { margin: 0; font-size: 1rem; }
.exchange-badge { display: flex; align-items: center; gap: 8px; }
.exchange-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #151b22; }
.exchange-logo-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--cyan); font: 700 .58rem var(--mono); }
.exchange-badge .image-stack { width: 24px; height: 24px; }
.badge { padding: 6px 8px; border: 1px solid var(--line-hot); color: #aab7c2; font: .66rem var(--mono); letter-spacing: .08em; }
.badge.debridge { border-color: rgba(133,244,228,.32); color: var(--cyan); background: rgba(133,244,228,.06); }
.badge.relay { border-color: rgba(112,144,255,.38); color: #a9baff; background: rgba(112,144,255,.08); }
.key-values { display: grid; gap: 17px; }
.key-value { min-width: 0; }
.key-value strong, .key-value code { display: block; overflow: hidden; font: 500 .82rem/1.45 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.key-value .amount { color: var(--text); font-family: var(--sans); font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.resolver-note { color: #586470; font: .62rem var(--mono); letter-spacing: .09em; }
.order-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.order-facts > div { padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.015); }
.order-facts strong { display: block; overflow: hidden; font: 600 .76rem var(--mono); text-overflow: ellipsis; white-space: nowrap; }

.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; }
.asset { min-width: 0; padding: 2px 0; }
.asset:last-child { text-align: right; }
.route-side { display: block; margin-bottom: 13px; color: #5e6b77; font: 650 .62rem var(--mono); letter-spacing: .12em; }
.asset-head { display: flex; align-items: center; gap: 13px; }
.asset:last-child .asset-head { flex-direction: row-reverse; }
.image-stack { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; overflow: hidden; border-radius: 50%; }
.asset-head .image-stack { width: 46px; height: 46px; }
.asset-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #171d24; }
.asset-logo-fallback { display: grid; place-items: center; width: 100%; height: 100%; border: 1px solid #34404c; border-radius: 50%; color: var(--cyan); background: #171d24; font: 700 .72rem var(--mono); }
.asset-symbol { display: block; margin-bottom: 6px; font-size: 1.6rem; font-weight: 720; }
.asset-amount { color: #bbc5ce; font: .84rem var(--mono); }
.asset-chain { margin-top: 12px; color: var(--muted); font: .7rem var(--mono); }
.route-arrow { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line-hot); color: var(--cyan); font-size: 1.2rem; }

.preswap-card { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 20px 170px 20px 22px; border: 1px solid var(--line); background: rgba(13,17,23,.78); }
.preswap-asset { min-width: 0; display: flex; align-items: center; gap: 12px; }
.preswap-asset:nth-of-type(2) { flex-direction: row-reverse; text-align: right; }
.preswap-asset .image-stack { width: 34px; height: 34px; }
.preswap-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #171d24; }
.preswap-logo-fallback { display: grid; place-items: center; width: 100%; height: 100%; border: 1px solid #34404c; border-radius: 50%; color: var(--cyan); font: 700 .62rem var(--mono); }
.preswap-asset span:not(.image-stack):not(.preswap-logo-fallback) { display: block; font-weight: 700; }
.preswap-asset strong { display: block; margin-top: 4px; color: var(--muted); font: 500 .72rem var(--mono); }
.preswap-arrow { color: var(--cyan); }
.preswap-chain { position: absolute; right: 20px; padding: 7px 9px; border: 1px solid var(--line); color: #77848f; font: .62rem var(--mono); letter-spacing: .08em; }

.notice { padding: 24px; border: 1px solid var(--line); color: #99a5b0; background: var(--panel); line-height: 1.6; }
.notice strong { display: block; margin-bottom: 5px; color: var(--text); }
.external-link { display: inline-flex; margin-top: 16px; color: var(--cyan); font: 700 .68rem var(--mono); letter-spacing: .08em; text-decoration: none; }
.external-link:hover { color: #b0fff4; }
.loading-card { display: grid; place-items: center; min-height: 180px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: .78rem var(--mono); }
.scanner { width: 180px; height: 2px; margin-bottom: 18px; overflow: hidden; background: #1c252e; }
.scanner::after { content: ""; display: block; width: 45%; height: 100%; background: var(--cyan); animation: scan 1.1s infinite ease-in-out; }
@keyframes scan { from { transform: translateX(-110%); } to { transform: translateX(330%); } }

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,.07);
  color: #4f5a65;
  font: .65rem var(--mono);
  letter-spacing: .1em;
}

@media (max-width: 760px) {
  .topbar, main, footer { width: min(100% - 28px, 1020px); }
  .topbar { height: 68px; }
  .network-pill { font-size: .64rem; }
  .intro { padding: 72px 0 38px; }
  h1 { font-size: clamp(2.8rem, 14vw, 5rem); }
  .lede { margin: 24px 0 32px; font-size: 1rem; }
  .search-panel { padding: 12px; }
  .search-row { grid-template-columns: auto 1fr; }
  .prompt { width: 48px; }
  #contract-address { border-right: 1px solid var(--line); padding: 0 12px; }
  button { grid-column: 1 / -1; min-height: 52px; margin-top: 9px; }
  .process { gap: 8px; }
  .process div { font-size: .62rem; }
  .process div span { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .route { gap: 12px; }
  .asset-symbol { font-size: 1.25rem; }
  .preswap-card { padding: 18px; }
  .preswap-chain { position: static; grid-column: 1 / -1; justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
