/* RicSwap Obsidian — match ricswap.com / swap.html */
:root {
  --void: #030407;
  --deep: #05060e;
  --well: #080918;
  --card: #0e1022;
  --lift: #12142c;
  --rim: rgba(255, 255, 255, 0.055);
  --rim2: rgba(255, 77, 0, 0.28);
  --magma: #ff4d00;
  --ember: #ff8c00;
  --gold: #e8b84b;
  --green: #00ffb2;
  --red: #ff3366;
  --ash: #383b52;
  --smoke: #656880;
  --fog: #a0a2bc;
  --mist: #c4c6dc;
  --white: #eef0f8;
  --mono: "JetBrains Mono", monospace;
  --display: "Bebas Neue", sans-serif;
  --body: "DM Sans", sans-serif;
  --radius: 16px;
}

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

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

body {
  background: var(--void);
  color: var(--fog);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(255, 77, 0, 0.15);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 77, 0, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 77, 0, 0.016) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ember); }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(96px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(80px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: 72px;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(3, 4, 7, 0.78);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--rim);
}
.nav > .brand,
.nav > .nav-links,
.nav > .nav-right {
  min-height: 72px;
  display: flex;
  align-items: center;
}
.nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 0, 0.4), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: inherit;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--lift);
  box-shadow: 0 8px 20px rgba(255, 77, 0, 0.25);
}
.logo-word {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 2px;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--magma));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--smoke);
}
.nav-links a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
}
.nav-links a.active {
  color: var(--white);
  background: rgba(255, 77, 0, 0.12);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.net-pill, #net-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 255, 178, 0.22);
  background: rgba(0, 255, 178, 0.06);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  letter-spacing: 0.4px;
}

.wallet-btn, .ghost, .danger, .tab {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.wallet-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  letter-spacing: 0.4px;
  background: linear-gradient(135deg, var(--magma), var(--ember));
  color: #fff;
}
.wallet-btn.connected {
  background: rgba(0, 255, 178, 0.1);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 178, 0.3);
}

.ghost, .danger {
  border: 1px solid var(--rim);
  background: var(--lift);
  color: var(--mist);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
}
.ghost:hover { border-color: var(--magma); color: var(--white); }
.danger { color: var(--red); border-color: rgba(255, 51, 102, 0.35); }

.hero {
  padding: 12px 0 8px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.hero h2 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: 1px;
  line-height: 0.95;
  color: var(--white);
  margin-bottom: 12px;
}
.hero p { color: var(--fog); max-width: 640px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 77, 0, 0.08);
  color: var(--ember);
  border: 1px solid var(--rim2);
}

.notice, .warn {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--fog);
}
.notice {
  background: rgba(232, 184, 75, 0.06);
  border: 1px solid rgba(232, 184, 75, 0.22);
}
.warn {
  background: rgba(255, 77, 0, 0.07);
  border: 1px solid var(--rim2);
  color: var(--ember);
}
.notice strong, .warn strong { color: var(--white); }

.guide {
  margin: 18px 0 0;
  padding: 0 22px 22px;
  background: var(--card);
  border: 1px solid var(--rim);
  border-radius: var(--radius);
}
.guide summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mist);
  user-select: none;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before {
  content: "▸ ";
  color: var(--gold);
}
.guide[open] summary::before { content: "▾ "; }
.guide[open] summary { padding-bottom: 12px; color: var(--white); }
.guide > p { color: var(--fog); margin: 8px 0 16px; font-size: 0.92rem; }
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-col {
  background: var(--lift);
  border: 1px solid var(--rim);
  border-radius: 12px;
  padding: 16px;
}
.guide-col h4 {
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.guide-col ol { margin: 0 0 0 18px; color: var(--fog); font-size: 0.88rem; }
.guide-col li { margin-bottom: 8px; }
.guide-col code {
  color: var(--gold);
  word-break: break-all;
}
.guide-note {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--smoke);
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 18px;
  padding: 6px;
  background: var(--well);
  border: 1px solid var(--rim);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.tab {
  border: none;
  background: transparent;
  color: var(--smoke);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
}
.tab.active {
  color: var(--white);
  background: linear-gradient(135deg, rgba(255, 77, 0, 0.35), rgba(255, 140, 0, 0.2));
  box-shadow: inset 0 0 0 1px var(--rim2);
}

.panel { display: none; }
.panel.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 20px;
}
.hit header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  flex-wrap: wrap;
}
.hit header .mono { max-width: 100%; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .grid { grid-template-columns: 1fr; }
  .logo-word { font-size: 22px; letter-spacing: 1px; }
  .wrap {
    padding-top: calc(84px + env(safe-area-inset-top, 0px));
  }
}

@media (max-width: 720px) {
  #btn-switch { display: none !important; }
  .tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .tab {
    min-height: 44px;
    width: 100%;
    padding: 10px 8px;
  }
  .card { padding: 16px; }
  .hero h2 { font-size: clamp(1.85rem, 9vw, 2.6rem); }
  .actions .ghost, .actions .danger, .submit, .wallet-btn {
    min-height: 44px;
  }
  .stat {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  #net-pill { display: none !important; }
  .logo-word { display: none; }
  .nav > .brand, .nav > .nav-right { min-height: 56px; }
  .nav { gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .wallet-btn { padding: 8px 12px; font-size: 12px; }
  .wrap {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  }
  .hero-eyebrow { font-size: 10px; letter-spacing: 0.8px; }
  .pills { gap: 6px; }
  .guide { padding: 0 14px 14px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--rim);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.card h3 {
  font-size: 1.02rem;
  color: var(--white);
  margin-bottom: 14px;
}

label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--mist); margin-bottom: 6px; }
.hint { font-weight: 500; color: var(--smoke); }

input, textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--rim);
  background: var(--lift);
  color: var(--white);
  font-family: inherit;
  font-size: 16px;
  margin-bottom: 14px;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--rim2);
}
textarea {
  min-height: 88px;
  font-family: var(--mono);
  font-size: 16px;
  resize: vertical;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }

.submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--magma), var(--ember));
  color: #fff;
  cursor: pointer;
}
.submit:hover { box-shadow: 0 8px 24px rgba(255, 77, 0, 0.35); }
.submit:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.status { margin-top: 12px; font-size: 0.88rem; color: var(--smoke); min-height: 1.2em; }
.status.err { color: var(--red); }
.status.ok { color: var(--green); }

.mono, code { font-family: var(--mono); font-size: 0.78rem; word-break: break-all; color: var(--mist); }

.meta-box {
  background: var(--lift);
  border: 1px dashed var(--rim2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  color: var(--gold);
}

.hit {
  border: 1px solid var(--rim);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--lift);
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.header-actions { margin: 0; }

.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rim);
  font-size: 0.9rem;
  color: var(--white);
}
.stat:last-child { border-bottom: none; }
.stat span { color: var(--smoke); }

footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--rim);
  font-size: 0.78rem;
  color: var(--smoke);
}

ul, ol { margin: 0 0 0 18px; color: var(--fog); font-size: 0.9rem; }
li { margin-bottom: 6px; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--fog);
}
.check input { width: auto; margin: 4px 0 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
