:root {
  color-scheme: dark;
  --bg: #080806;
  --panel: #11100d;
  --panel-soft: #17140f;
  --field: #1d1a14;
  --line: #352d1e;
  --line-strong: #6f5520;
  --text: #fff8e7;
  --muted: #b9ad94;
  --soft: #817867;
  --gold: #f4b83f;
  --gold-bright: #ffe68a;
  --gold-deep: #9b6817;
  --blue: #4fb9de;
  --blue-deep: #1b7896;
  --green: #31d0aa;
  --amber: #f8c14a;
  --red: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #080806;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(255, 226, 138, 0.08), transparent 34%),
    linear-gradient(160deg, #080806 0%, #12110e 48%, #050606 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--gold-bright);
}

.brand img,
.token-logo,
.token-fallback {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.brand img {
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 226, 138, 0.24), 0 10px 28px rgba(244, 184, 63, 0.12);
}

.nav-links {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 226, 138, 0.1);
  border-radius: 999px;
  background: rgba(255, 226, 138, 0.045);
}

.nav-links a {
  min-width: 76px;
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.nav-links a[aria-current="page"] {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 230, 138, 0.2), rgba(155, 104, 23, 0.24));
}

.wallet-root {
  justify-self: end;
  min-width: 132px;
}

.wallet-root [data-tc-button="true"] {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold)) !important;
  color: #1a1106 !important;
  border: 1px solid rgba(255, 230, 138, 0.36) !important;
  box-shadow: 0 14px 34px rgba(244, 184, 63, 0.22) !important;
}

.wallet-root [data-tc-button="true"] svg,
.wallet-root [data-tc-button="true"] path {
  color: #1a1106 !important;
  fill: #1a1106 !important;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 42px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 6vw, 68px);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.hero-brand {
  display: grid;
  justify-items: end;
}

.network-pill,
.route-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 230, 138, 0.32);
  border-radius: 999px;
  background: rgba(244, 184, 63, 0.1);
  color: #fff1b7;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 14px rgba(49, 208, 170, 0.9);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(360px, 520px);
  justify-content: center;
  align-items: start;
  gap: 22px;
}

.market-panel,
.swap-card,
.token-dialog {
  border: 1px solid rgba(255, 230, 138, 0.12);
  border-radius: 8px;
  background: rgba(17, 16, 13, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.market-panel {
  padding: 18px;
}

.panel-heading,
.swap-card-head,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.ghost-icon:hover,
.ghost-icon:focus-visible {
  border-color: rgba(255, 230, 138, 0.2);
  background: rgba(255, 230, 138, 0.08);
  color: var(--text);
  outline: none;
}

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

.asset-list {
  display: grid;
  gap: 10px;
}

.asset-row,
.token-result {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(255, 230, 138, 0.09);
  border-radius: 8px;
  background: rgba(255, 230, 138, 0.035);
}

.asset-row {
  padding: 10px;
}

.token-result {
  padding: 12px;
  text-align: left;
  color: var(--text);
}

.asset-row:hover,
.token-result:hover,
.token-result:focus-visible {
  border-color: rgba(255, 230, 138, 0.42);
  background: rgba(244, 184, 63, 0.1);
  outline: none;
}

.asset-main,
.token-meta {
  min-width: 0;
}

.asset-main strong,
.token-meta strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-main span,
.token-meta span,
.asset-price {
  color: var(--muted);
  font-size: 12px;
}

.asset-price {
  font-weight: 800;
}

.token-logo {
  object-fit: cover;
  background: #111820;
}

.token-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #191106;
  font-size: 13px;
  font-weight: 900;
}

.swap-card {
  position: relative;
  padding: 20px;
}

.swap-card-head {
  margin-bottom: 18px;
}

.swap-card h2 {
  font-size: 25px;
}

.swap-box {
  min-height: 124px;
  padding: 18px;
  border: 1px solid rgba(255, 230, 138, 0.1);
  border-radius: 8px;
  background: var(--field);
}

.receive-box {
  margin-top: 10px;
}

.field-label,
.controls-grid,
.details-panel,
.amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-label {
  min-height: 26px;
  color: var(--muted);
  font-size: 13px;
}

.max-button {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 230, 138, 0.14);
  color: #fff0ad;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.max-button:hover,
.max-button:focus-visible {
  background: rgba(255, 230, 138, 0.22);
  outline: none;
}

.amount-row {
  margin-top: 12px;
}

.amount-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0;
  outline: none;
}

.amount-row input::placeholder {
  color: rgba(246, 248, 251, 0.32);
}

.token-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 124px;
  height: 48px;
  padding: 6px 11px;
  border: 1px solid rgba(255, 230, 138, 0.12);
  border-radius: 999px;
  background: rgba(255, 230, 138, 0.075);
  color: var(--text);
  font-weight: 900;
}

.token-button:hover,
.token-button:focus-visible {
  border-color: rgba(255, 230, 138, 0.55);
  background: rgba(244, 184, 63, 0.15);
  outline: none;
}

.token-button img,
.token-button .token-fallback {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 10px;
}

.token-button::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.65;
}

.fiat-line {
  margin-top: 6px;
  color: var(--soft);
  font-size: 13px;
}

.quote-state {
  color: var(--gold-bright);
  font-weight: 800;
}

.flip-button {
  position: relative;
  z-index: 1;
  display: grid;
  width: 48px;
  height: 48px;
  margin: -8px auto -18px;
  place-items: center;
  border: 6px solid var(--panel);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #1a1106;
  box-shadow: 0 18px 36px rgba(244, 184, 63, 0.22);
}

.flip-button:hover,
.flip-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.controls-grid {
  margin-top: 14px;
}

.control-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.control-field select {
  height: 38px;
  border: 1px solid rgba(255, 230, 138, 0.12);
  border-radius: 8px;
  background: #17140f;
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

.route-chip {
  max-width: 240px;
  overflow: hidden;
  border-color: rgba(255, 230, 138, 0.28);
  background: rgba(244, 184, 63, 0.08);
  color: #fff1b7;
  text-overflow: ellipsis;
}

.details-panel {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgba(255, 230, 138, 0.1);
  border-radius: 8px;
  background: rgba(255, 230, 138, 0.035);
}

.details-panel div {
  display: grid;
  gap: 6px;
}

.details-panel span {
  color: var(--muted);
  font-size: 12px;
}

.details-panel strong {
  font-size: 13px;
  white-space: nowrap;
}

.notice {
  display: none;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 230, 138, 0.24);
  border-radius: 8px;
  background: rgba(244, 184, 63, 0.1);
  color: #fff1b7;
  font-size: 13px;
  line-height: 1.45;
}

.notice.is-error {
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.1);
  color: #ffd0d0;
}

.notice.is-success {
  border-color: rgba(49, 208, 170, 0.3);
  background: rgba(49, 208, 170, 0.1);
  color: #c9fff2;
}

.notice.is-visible {
  display: block;
}

.swap-button {
  width: 100%;
  min-height: 58px;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1a1106;
  font-weight: 900;
  box-shadow: 0 18px 42px rgba(244, 184, 63, 0.25);
}

.swap-button:hover,
.swap-button:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.swap-button:disabled {
  cursor: not-allowed;
  background: #373024;
  color: #8f826b;
  box-shadow: none;
}

.risk-note {
  margin-top: 12px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.token-dialog {
  width: min(460px, calc(100% - 28px));
  max-height: min(720px, calc(100vh - 42px));
  margin: auto;
  padding: 18px;
  color: var(--text);
}

.token-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.dialog-head h2 {
  font-size: 20px;
}

.token-search {
  width: 100%;
  height: 48px;
  margin: 14px 0;
  border: 1px solid rgba(255, 230, 138, 0.12);
  border-radius: 8px;
  background: #17140f;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.token-search:focus {
  border-color: rgba(255, 230, 138, 0.55);
}

.token-results {
  display: grid;
  max-height: min(510px, calc(100vh - 190px));
  overflow: auto;
  gap: 8px;
  padding-right: 2px;
}

.token-result.is-selected {
  border-color: rgba(255, 230, 138, 0.5);
  background: rgba(244, 184, 63, 0.13);
}

.empty-state {
  padding: 24px 8px;
  color: var(--muted);
  text-align: center;
}

.skeleton-line {
  height: 62px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 230, 138, 0.035), rgba(255, 230, 138, 0.09), rgba(255, 230, 138, 0.035));
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-line.short {
  width: 78%;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -20% 0;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 38px;
  }

  .hero-brand {
    justify-items: start;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .market-panel {
    order: 2;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    padding-top: 10px;
  }

  .topbar {
    gap: 10px;
  }

  .brand span {
    display: none;
  }

  .wallet-root {
    min-width: 0;
  }

  .intro-copy {
    font-size: 15px;
  }

  .swap-card,
  .market-panel,
  .token-dialog {
    padding: 14px;
  }

  .swap-box {
    min-height: 112px;
    padding: 14px;
  }

  .amount-row input {
    font-size: 30px;
  }

  .token-button {
    min-width: 106px;
  }

  .controls-grid,
  .details-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .details-panel {
    gap: 12px;
  }

  .details-panel div {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .route-chip {
    max-width: none;
  }
}
