/* Nanfin — Uniswap-style layout, brand tokens preserved */
:root {
  --lime: #d4fa00;
  --ink: #0a0a0a;
  --white: #ffffff;
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #1b1b1b;
  --surface-3: #222222;
  --surface-hover: #2a2a2a;
  --ink-soft: #141414;
  --ink-muted: #9b9b9b;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-tertiary: rgba(255, 255, 255, 0.38);
  --lime-dim: #b8d900;
  --lime-wash: rgba(212, 250, 0, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(212, 250, 0, 0.35);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 999px;
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 40px 80px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.28);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --max: 1120px;
  --swap-w: 480px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--white);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--lime);
  color: var(--ink);
  padding: 0.7rem 1rem;
  z-index: 1000;
  border-radius: var(--radius-xs);
  font-weight: 600;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ========== NAVBAR (Uniswap pattern) ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-header.is-dark {
  background: rgba(10, 10, 10, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.header-inner {
  width: min(100% - 2rem, 1200px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  justify-self: start;
  transition: opacity 0.15s var(--ease);
}

.brand:hover {
  opacity: 0.85;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  justify-self: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0.5rem;
}

.nav a:not(.btn) {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.nav a:not(.btn):hover,
.nav a:not(.btn):focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.nav a[aria-current="page"] {
  color: var(--white);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease), box-shadow 0.2s var(--ease), border-color 0.15s var(--ease),
    opacity 0.15s var(--ease);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}

.btn-primary:hover:not(:disabled) {
  background: var(--lime-dim);
  box-shadow: 0 0 0 4px rgba(212, 250, 0, 0.12);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
  font-weight: 600;
}

.btn-lime:hover:not(:disabled) {
  background: var(--lime-dim);
  box-shadow: 0 0 0 4px rgba(212, 250, 0, 0.14);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--white);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-block {
  width: 100%;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
}

/* ========== FOOTER ========== */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer.is-dark {
  background: transparent;
  border-top-color: rgba(255, 255, 255, 0.06);
  color: var(--text-tertiary);
}

.footer-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-tertiary);
}

/* ========== LANDING ========== */
.landing-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--white);
}

.hero {
  width: min(100% - 2rem, 720px);
  margin: 0 auto;
  padding: clamp(5rem, 14vh, 8.5rem) 0 clamp(3.5rem, 8vh, 5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 90vw);
  height: 280px;
  background: radial-gradient(ellipse at center, rgba(212, 250, 0, 0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 0;
  border: none;
  border-radius: 0;
  margin-bottom: 1.25rem;
  background: none;
  color: var(--lime);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--lime);
  border-radius: 1px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 1.25rem;
  color: var(--white);
}

.hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.6;
  max-width: 34rem;
  margin-bottom: 2rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0;
}

.hero-visual {
  display: none;
}

/* Feature row under hero */
.features {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto clamp(4rem, 10vw, 6rem);
}

.section-head {
  margin-bottom: 1.75rem;
  text-align: center;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--white);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature-card {
  background: var(--surface);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.35rem;
  border: 1px solid var(--border);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.feature-card:hover {
  border-color: rgba(212, 250, 0, 0.22);
  background: var(--surface-2);
  transform: none;
  box-shadow: none;
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--lime-wash);
  color: var(--lime);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.feature-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Mini highlight row (stats under hero) */
.highlight-row {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto 3.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.2s var(--ease);
}

.highlight-card:hover {
  border-color: rgba(212, 250, 0, 0.2);
}

.highlight-card strong {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--white);
}

.highlight-card span {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.highlight-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--lime-wash);
  color: var(--lime);
  display: grid;
  place-items: center;
  margin-bottom: 0.5rem;
}

.highlight-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* CTA band */
.cta-band {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto clamp(4rem, 10vw, 6rem);
  background: var(--surface);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.cta-band::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -5%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(212, 250, 0, 0.08), transparent 70%);
  pointer-events: none;
}

.cta-band > * {
  position: relative;
  z-index: 1;
}

.cta-band h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.cta-band p {
  color: var(--text-secondary);
  max-width: 30rem;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ========== APP (Uniswap swap widget) ========== */
.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--white);
}

.app-main {
  width: min(100% - 1.25rem, 560px);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
}

@media (min-height: 780px) {
  .app-main {
    justify-content: center;
    padding-top: 0.5rem;
    padding-bottom: 2rem;
  }
}

.app-title-row {
  display: none;
}

.wallet-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--lime);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Swap card shell */
.swap-card {
  width: 100%;
  max-width: var(--swap-w);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.swap-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.85rem;
}

.swap-card-head h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.swap-card-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 0.2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Input legs — Uniswap nested panels */
.leg {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 1rem 1rem 0.9rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.leg:focus-within {
  border-color: rgba(212, 250, 0, 0.28);
  background: #1e1e1e;
}

.leg + .leg {
  margin-top: 0;
}

.leg-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
  margin-bottom: 0.55rem;
}

.leg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.amount-wrap {
  min-width: 0;
}

.amount-input {
  width: 100%;
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.15rem);
  font-weight: 500;
  color: var(--white);
  outline: none;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.amount-input::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.amount-input:focus {
  color: var(--white);
}

#amount-out.amount-input {
  color: var(--white);
  min-height: 1.15em;
}

.amount-usd {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 0.35rem;
  min-height: 1.1em;
}

.selectors {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
  min-width: 0;
}

.select-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.55rem 0.4rem 0.4rem;
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
  text-align: left;
  max-width: 11rem;
}

.select-btn:hover,
.select-btn:focus-visible {
  background: var(--surface-hover);
  outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.select-btn img,
.token-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  object-fit: cover;
  flex-shrink: 0;
}

.select-btn .chev {
  margin-left: 0.1rem;
  opacity: 0.45;
  font-size: 0.65rem;
}

.select-btn .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 5.5rem;
}

/* Flip control — centered overlapping circle */
.swap-flip {
  display: flex;
  justify-content: center;
  margin: -10px 0;
  position: relative;
  z-index: 2;
}

.flip-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 4px solid var(--surface);
  background: var(--surface-2);
  color: var(--white);
  display: grid;
  place-items: center;
  transition: transform 0.3s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease), border-color 0.15s var(--ease);
  box-shadow: none;
}

.flip-btn:hover {
  transform: rotate(180deg);
  background: var(--lime);
  color: var(--ink);
  border-color: var(--surface);
  box-shadow: none;
}

.flip-btn svg {
  width: 16px;
  height: 16px;
}

.action-row {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding: 0 0.15rem 0.15rem;
}

.quote-panel {
  margin-top: 0.65rem;
  border-top: none;
  padding: 0.85rem 0.85rem 0.35rem;
  display: none;
  background: transparent;
}

.quote-panel.is-open {
  display: block;
}

.quote-grid {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.quote-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.85rem;
}

.quote-row span:first-child {
  color: var(--text-secondary);
}

.quote-row span:last-child {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
  color: var(--white);
}

.quote-row.is-highlight span:last-child {
  color: var(--lime);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Status */
.status-panel {
  margin-top: 0.65rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: none;
}

.status-panel.is-open {
  display: block;
}

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.status-head h3 {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--lime);
  color: var(--ink);
}

.status-badge.is-pending {
  background: var(--lime-wash);
  color: var(--lime);
  border: 1px solid rgba(212, 250, 0, 0.25);
}

.status-badge.is-failed {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.progress-bar {
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, var(--lime-dim), var(--lime));
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--ease);
}

.progress-bar.is-pulse {
  animation: pulse-bar 1.2s ease-in-out infinite;
}

@keyframes pulse-bar {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.status-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-detail .mono {
  color: var(--lime);
  word-break: break-all;
  font-size: 0.75rem;
}

/* Alerts */
.alert {
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.65rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 0.88rem;
}

.alert.is-open {
  display: flex;
}

.alert-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
  line-height: 1;
}

/* History */
.history {
  width: 100%;
  max-width: var(--swap-w);
  margin-top: 0.25rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  padding: 0 0.15rem;
}

.history-head h2 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: auto;
  background: var(--surface);
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 480px;
}

.tx-table th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.tx-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  vertical-align: middle;
  color: var(--text-secondary);
}

.tx-table tr:last-child td {
  border-bottom: none;
}

.tx-table .status-pill {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--lime-wash);
  color: var(--lime);
  border: 1px solid rgba(212, 250, 0, 0.2);
}

.tx-table .status-pill.success {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}

.tx-table .status-pill.failure,
.tx-table .status-pill.refund {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
}

.empty-state {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.empty-state strong {
  display: block;
  font-family: var(--font-body);
  color: var(--white);
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.is-open {
  display: flex;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal {
  width: min(100%, 420px);
  max-height: min(80vh, 560px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--white);
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.modal-close:hover {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}

.modal-search {
  padding: 0.75rem 1rem;
}

.modal-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  color: var(--white);
  font-size: 0.92rem;
  outline: none;
}

.modal-search input:focus {
  border-color: rgba(212, 250, 0, 0.4);
}

.modal-list {
  overflow-y: auto;
  flex: 1;
  padding: 0 0.5rem 0.75rem;
}

.modal-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.65rem;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--white);
  transition: background 0.12s var(--ease);
}

.modal-item:hover,
.modal-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.modal-item.is-active {
  background: var(--lime-wash);
  box-shadow: inset 0 0 0 1px rgba(212, 250, 0, 0.25);
}

.modal-item img,
.modal-item .modal-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  object-fit: cover;
  flex-shrink: 0;
  display: inline-block;
}

.modal-item .meta {
  min-width: 0;
  flex: 1;
}

.modal-item .meta strong {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
}

.modal-item .meta span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(10, 10, 10, 0.2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-lime .spinner,
.btn-primary .spinner {
  border-color: rgba(10, 10, 10, 0.2);
  border-top-color: var(--ink);
}

.btn-ghost .spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: var(--white);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== DOCS ========== */
.docs-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--white);
}

.docs-layout {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 2rem 0 3.5rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  flex: 1;
}

.docs-nav {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.docs-nav-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: var(--text-tertiary);
}

.docs-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.docs-nav a:hover,
.docs-nav a:focus-visible {
  background: var(--surface-2);
  color: var(--white);
  outline: none;
}

.docs-main {
  min-width: 0;
}

.docs-hero {
  margin-bottom: 2.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-kicker {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: 0.65rem;
  color: var(--lime);
}

.docs-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 0.85rem;
}

.docs-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 40rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.docs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.docs-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.docs-section h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.docs-section h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.docs-section p {
  margin-bottom: 0.85rem;
  max-width: 44rem;
  color: var(--text-secondary);
}

.docs-section a {
  font-weight: 600;
  color: var(--lime);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1.15rem 0;
}

.docs-step {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
  color: var(--white);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.docs-step p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.9rem;
}

.docs-step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--lime);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.docs-list {
  margin: 0.5rem 0 1rem 1.25rem;
  max-width: 44rem;
  color: var(--text-secondary);
}

.docs-list li {
  margin-bottom: 0.45rem;
}

.docs-callout {
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  max-width: 44rem;
  margin: 1rem 0;
  color: var(--text-secondary);
}

.docs-callout strong {
  color: var(--white);
}

.docs-table {
  width: 100%;
  max-width: 44rem;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.docs-table th {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--lime);
}

.docs-table td {
  color: var(--text-secondary);
  background: var(--surface);
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
  width: 30%;
  color: var(--white);
}

.docs-faq details {
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 0.6rem;
  background: var(--surface);
  max-width: 44rem;
}

.docs-faq summary {
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  color: var(--white);
}

.docs-faq summary::-webkit-details-marker {
  display: none;
}

.docs-faq details[open] summary {
  border-bottom: 1px solid var(--border);
}

.docs-faq details p {
  padding: 0.85rem 1rem 1rem;
  margin: 0;
  color: var(--text-secondary);
}

.docs-cta {
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--surface);
  color: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.docs-cta h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
  border: none;
  padding: 0;
}

.docs-cta p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .docs-nav-title {
    width: 100%;
  }

  .docs-steps {
    grid-template-columns: 1fr;
  }

  .docs-table {
    display: block;
    overflow-x: auto;
  }
}

/* 404 */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--white);
}

.page-404 main {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.page-404 h1 {
  font-family: var(--font-display);
  font-size: clamp(4rem, 15vw, 7.5rem);
  letter-spacing: -0.06em;
  line-height: 1;
  color: var(--white);
}

.page-404 p {
  margin: 0.75rem 0 1.5rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 860px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .nav {
    display: none;
  }

  .nav-actions {
    grid-column: 2;
  }

  .feature-grid,
  .highlight-row {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: clamp(3.5rem, 12vh, 5.5rem);
  }
}

@media (max-width: 520px) {
  .leg-row {
    grid-template-columns: 1fr;
  }

  .selectors {
    flex-direction: row;
    align-items: stretch;
    width: 100%;
  }

  .select-btn {
    flex: 1;
    max-width: none;
  }

  .nav .hide-sm,
  .hide-sm {
    display: none;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .header-inner {
    width: min(100% - 1.25rem, 1200px);
  }
}

/* Landing light-header override removed — all dark Uniswap shell */
.landing-body .site-header,
.docs-body .site-header,
.page-404 .site-header {
  background: rgba(10, 10, 10, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.landing-body .nav a:not(.btn),
.docs-body .nav a:not(.btn),
.page-404 .nav a:not(.btn) {
  color: var(--text-secondary);
}

.landing-body .nav a:not(.btn):hover,
.docs-body .nav a:not(.btn):hover,
.page-404 .nav a:not(.btn):hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
